From 8f1db6e819c4f7ccb93ecc6ff1c2e21ee3228dc3 Mon Sep 17 00:00:00 2001 From: duncte123 Date: Mon, 24 Jun 2024 20:15:57 +0200 Subject: [PATCH] Lint code --- .../skybot/commands/guild/mod/ModBaseCommand.java | 1 + .../duncte123/skybot/commands/mod/WarnCommand.kt | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bot/src/main/java/me/duncte123/skybot/commands/guild/mod/ModBaseCommand.java b/bot/src/main/java/me/duncte123/skybot/commands/guild/mod/ModBaseCommand.java index 3b498d800..d13ca9160 100644 --- a/bot/src/main/java/me/duncte123/skybot/commands/guild/mod/ModBaseCommand.java +++ b/bot/src/main/java/me/duncte123/skybot/commands/guild/mod/ModBaseCommand.java @@ -33,6 +33,7 @@ public ModBaseCommand() { this.userPermissions = new Permission[]{Permission.KICK_MEMBERS, Permission.BAN_MEMBERS}; } + @SuppressWarnings("PMD.EmptyMethodInAbstractClassShouldBeAbstract") @Override protected void configureSlashSupport(@NotNull SlashCommandData baseData) { // NO diff --git a/bot/src/main/kotlin/me/duncte123/skybot/commands/mod/WarnCommand.kt b/bot/src/main/kotlin/me/duncte123/skybot/commands/mod/WarnCommand.kt index 10e1de4bb..1b5ef0e97 100644 --- a/bot/src/main/kotlin/me/duncte123/skybot/commands/mod/WarnCommand.kt +++ b/bot/src/main/kotlin/me/duncte123/skybot/commands/mod/WarnCommand.kt @@ -20,8 +20,6 @@ package me.duncte123.skybot.commands.mod import com.dunctebot.models.settings.WarnAction import com.dunctebot.models.utils.DateUtils -import me.duncte123.botcommons.messaging.MessageUtils -import me.duncte123.botcommons.messaging.MessageUtils.sendErrorWithMessage import me.duncte123.botcommons.messaging.MessageUtils.sendMsg import me.duncte123.skybot.Variables import me.duncte123.skybot.commands.guild.mod.ModBaseCommand @@ -93,7 +91,6 @@ class WarnCommand : ModBaseCommand() { return } - val moderator = event.member!! val channel = event.channel @@ -109,7 +106,7 @@ class WarnCommand : ModBaseCommand() { |Reason: ${if (reason.isEmpty()) "No reason given" else "`$reason`"} """.trimMargin() - event.deferReply().queue(); + event.deferReply().queue() // add the new warning to the database val future = variables.database.createWarning( @@ -164,7 +161,14 @@ class WarnCommand : ModBaseCommand() { .find { threshold >= it.threshold } } - private fun invokeAction(warnings: Int, action: WarnAction, modUser: User, target: Member, guild: DunctebotGuild, variables: Variables) { + private fun invokeAction( + warnings: Int, + action: WarnAction, + modUser: User, + target: Member, + guild: DunctebotGuild, + variables: Variables, + ) { val targetUser = target.user if ((action.type == WarnAction.Type.MUTE || action.type == WarnAction.Type.TEMP_MUTE) &&