From a7d49be9624dc5cf9b3a85819610fee177012ab8 Mon Sep 17 00:00:00 2001 From: floppydiskette Date: Tue, 19 Nov 2024 01:25:54 +0000 Subject: [PATCH] Add timeout get option --- .../hypr/doki/commands/moderation/Timeout.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/hypr/doki/commands/moderation/Timeout.java b/src/main/java/net/hypr/doki/commands/moderation/Timeout.java index a3fcac7..f8706e1 100644 --- a/src/main/java/net/hypr/doki/commands/moderation/Timeout.java +++ b/src/main/java/net/hypr/doki/commands/moderation/Timeout.java @@ -36,10 +36,25 @@ public class Timeout extends ApplicationCommand { subcommand = "cancel", description = "Cancels the specified users timeout" ) - public void cancelMute(GuildSlashEvent event, + public void cancelTimeout(GuildSlashEvent event, @AppOption(name = "member") Member member) { OffsetDateTime timeoutEnd = member.getTimeOutEnd(); member.removeTimeout().queue(); event.replyFormat("Removed %s's timeout (%s remaining)", member.getAsMention(), DurationUtils.getTimeDifference(timeoutEnd)).queue(); } + + @JDASlashCommand( + name = "timeout", + subcommand = "get", + description = "Gets the specified users timeout status" + ) + public void getTimeout(GuildSlashEvent event, + @AppOption(name = "member") Member member) { + if (member.isTimedOut()) { + OffsetDateTime timeoutEnd = member.getTimeOutEnd(); + event.replyFormat("%s is timed out for another %s", member.getAsMention(), DurationUtils.getTimeDifference(timeoutEnd)).setEphemeral(true).queue(); + } else { + event.replyFormat("%s isn't timed out!", member.getAsMention()).setEphemeral(true).queue(); + } + } }