diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 41dbda4..e28d6f3 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,14 +1,7 @@ \ No newline at end of file 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 bcdab66..796178e 100644 --- a/src/main/java/net/hypr/doki/commands/moderation/Timeout.java +++ b/src/main/java/net/hypr/doki/commands/moderation/Timeout.java @@ -2,7 +2,6 @@ package net.hypr.doki.commands.moderation; import com.freya02.botcommands.api.annotations.BotPermissions; import com.freya02.botcommands.api.annotations.CommandMarker; -import com.freya02.botcommands.api.annotations.Optional; import com.freya02.botcommands.api.annotations.UserPermissions; import com.freya02.botcommands.api.application.ApplicationCommand; import com.freya02.botcommands.api.application.annotations.AppOption; @@ -14,7 +13,6 @@ import net.hypr.doki.utils.DurationUtils; import java.time.Duration; import java.time.OffsetDateTime; -import java.util.Objects; @CommandMarker @BotPermissions(Permission.MODERATE_MEMBERS) @@ -27,15 +25,13 @@ public class Timeout extends ApplicationCommand { ) public void timeout(GuildSlashEvent event, @AppOption(name = "member") Member member, - @AppOption(name = "duration", description = "ex: 2h5m, must be between 1m and 7d") String duration, - @Optional @AppOption(name = "reason") String reason) { + @AppOption(name = "duration", description = "ex: 2h5m, must be between 1m and 7d") String duration) { Duration timeoutDuration = DurationUtils.parseDuration(duration); if (!DurationUtils.isDurationBetween(timeoutDuration, Duration.ofMinutes(1), Duration.ofDays(7))) { event.replyFormat("Invalid duration %s!, must be between 1m and 7d", duration).queue(); return; } - member.timeoutFor(timeoutDuration) - .reason(Objects.requireNonNullElse(reason, "No reason provided")).queue(); + member.timeoutFor(timeoutDuration).queue(); event.replyFormat("Timed out %s for %s", member.getAsMention(), duration).queue(); } diff --git a/src/main/java/net/hypr/doki/utils/DurationUtils.java b/src/main/java/net/hypr/doki/utils/DurationUtils.java index 2341fbb..208f8e9 100644 --- a/src/main/java/net/hypr/doki/utils/DurationUtils.java +++ b/src/main/java/net/hypr/doki/utils/DurationUtils.java @@ -47,7 +47,6 @@ public class DurationUtils { .plusSeconds(seconds); } - @SuppressWarnings("BooleanMethodIsAlwaysInverted") public static boolean isDurationBetween(Duration target, Duration lowerThreshold, Duration upperThreshold) { if (target == lowerThreshold || target == upperThreshold) return true; return !target.isNegative() &&