diff --git a/src/main/java/ml/duncte123/skybot/commands/guild/mod/AnnounceCommand.java b/src/main/java/ml/duncte123/skybot/commands/guild/mod/AnnounceCommand.java index 3f5e4253b..a50495ae8 100644 --- a/src/main/java/ml/duncte123/skybot/commands/guild/mod/AnnounceCommand.java +++ b/src/main/java/ml/duncte123/skybot/commands/guild/mod/AnnounceCommand.java @@ -79,7 +79,7 @@ public void executeCommand(String invoke, String[] args, GuildMessageReceivedEve MessageUtils.sendSuccess(event.getMessage()); } catch (ArrayIndexOutOfBoundsException ex) { - MessageUtils.sendErrorWithMessage(event.getMessage(), event, "Please! You either forgot the text or to mention the channel!"); + MessageUtils.sendErrorWithMessage(event.getMessage(), "Please! You either forgot the text or to mention the channel!"); ComparatingUtils.execCheck(ex); } catch (Exception e) { diff --git a/src/main/java/ml/duncte123/skybot/commands/guild/owner/SettingsCommand.java b/src/main/java/ml/duncte123/skybot/commands/guild/owner/SettingsCommand.java index d6ab73831..f55343bdf 100644 --- a/src/main/java/ml/duncte123/skybot/commands/guild/owner/SettingsCommand.java +++ b/src/main/java/ml/duncte123/skybot/commands/guild/owner/SettingsCommand.java @@ -245,7 +245,7 @@ public void executeCommand(String invoke, String[] args, GuildMessageReceivedEve case "toggleautodehoist": boolean shouldAutoDeHoist = !settings.isAutoDeHoist(); GuildSettingsUtils.updateGuildSettings(event.getGuild(), settings.setAutoDeHoist(shouldAutoDeHoist) ); - sendMsg(event, "Filtering discord invites has been **" + sendMsg(event, "Auto de-hoisting has been **" + ( shouldAutoDeHoist ? "enabled" : "disabled" ) + "**" ); break; } diff --git a/src/main/java/ml/duncte123/skybot/utils/MessageUtils.java b/src/main/java/ml/duncte123/skybot/utils/MessageUtils.java index e6face61f..15eb950f7 100644 --- a/src/main/java/ml/duncte123/skybot/utils/MessageUtils.java +++ b/src/main/java/ml/duncte123/skybot/utils/MessageUtils.java @@ -60,31 +60,14 @@ public static void sendError(Message message) { } } message.addReaction("❌").queue(null, CUSTOM_QUEUE_ERROR); - } - - /** - * This method uses the sendError and sendMsg methods - * - * @param message the {@link Message} for the sendError method - * @param textChannel the {@link TextChannel} for the sendMsg method - * @param text the {@link String} for the sendMsg method - */ - public static void sendErrorWithMessage(Message message, TextChannel textChannel, String text) { - sendError(message); - sendMsg(textChannel, text); - } - - - /** + } /** * This method uses the sendError and sendMsg methods - * - * @param message the {@link Message} for the sendError method - * @param event the {@link GuildMessageReceivedEvent} for the sendMsg method + * @param message the {@link Message} for the sendError method * @param text the {@link String} for the sendMsg method */ - public static void sendErrorWithMessage(Message message, GuildMessageReceivedEvent event, String text) { + public static void sendErrorWithMessage(Message message, String text) { sendError(message); - sendMsg(event, text); + sendMsg(message.getTextChannel(), text); } /** @@ -133,24 +116,11 @@ public static void sendSuccess(Message message) { * This method uses the sendSuccess and sendMsg methods * * @param message the {@link Message} for the sendSuccess method - * @param channel the {@link TextChannel} for the sendMsg method - * @param text the {@link String} for the sendMsg method - */ - public static void sendSuccessWithMessage(Message message, TextChannel channel, String text) { - sendSuccess(message); - sendMsg(channel, text); - } - - /** - * This method uses the sendSuccess and sendMsg methods - * - * @param message the {@link Message} for the sendSuccess method - * @param event the {@link GuildMessageReceivedEvent} for the sendMsg method * @param text the {@link String} for the sendMsg method */ - public static void sendSuccessWithMessage(Message message, GuildMessageReceivedEvent event, String text) { + public static void sendSuccessWithMessage(Message message, String text) { sendSuccess(message); - sendMsg(event, text); + sendMsg(message.getTextChannel(), text); } /** diff --git a/src/main/kotlin/ml/duncte123/skybot/commands/essentials/eval/EvalCommand.kt b/src/main/kotlin/ml/duncte123/skybot/commands/essentials/eval/EvalCommand.kt index 1b365e27b..1417d2396 100644 --- a/src/main/kotlin/ml/duncte123/skybot/commands/essentials/eval/EvalCommand.kt +++ b/src/main/kotlin/ml/duncte123/skybot/commands/essentials/eval/EvalCommand.kt @@ -213,18 +213,18 @@ class EvalCommand : Command() { } is ExecutionException, is ScriptException -> { out as Exception - MessageUtils.sendErrorWithMessage(event.message, event, "ERROR: " + out.cause.toString()) + MessageUtils.sendErrorWithMessage(event.message, "ERROR: " + out.cause.toString()) } is TimeoutException, is InterruptedException, is IllegalStateException -> { out as Exception coroutine.coroutineContext.cancel() if (coroutine.isActive) coroutine.coroutineContext.cancel() - MessageUtils.sendErrorWithMessage(event.message, event, "ERROR: " + out.toString()) + MessageUtils.sendErrorWithMessage(event.message, "ERROR: " + out.toString()) } is IllegalArgumentException, is VRCubeException -> { out as RuntimeException - MessageUtils.sendErrorWithMessage(event.message, event, "ERROR: " + out.toString()) + MessageUtils.sendErrorWithMessage(event.message, "ERROR: " + out.toString()) } is Throwable -> { if (Settings.useJSON) @@ -246,7 +246,7 @@ class EvalCommand : Command() { .forEach { it -> MessageUtils.sendMsg(event, it) } } else { if (filter.containsMentions(out.toString())) { - MessageUtils.sendErrorWithMessage(event.message, event, "**ERROR:** Mentioning people!") + MessageUtils.sendErrorWithMessage(event.message, "**ERROR:** Mentioning people!") } else { MessageUtils.sendMsg(event, "**" + event.author.name + ":** " + out.toString() diff --git a/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarnCommand.kt b/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarnCommand.kt index 443938031..393b75b82 100644 --- a/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarnCommand.kt +++ b/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarnCommand.kt @@ -42,7 +42,7 @@ class WarnCommand: Command() { } val target = event.message.mentionedMembers[0] if (target.user == event.jda.selfUser) { - MessageUtils.sendErrorWithMessage(event.message, event, "You can not warn me") + MessageUtils.sendErrorWithMessage(event.message, "You can not warn me") return } if(!event.member.canInteract(target)) { diff --git a/src/main/kotlin/ml/duncte123/skybot/commands/music/RadioCommand.kt b/src/main/kotlin/ml/duncte123/skybot/commands/music/RadioCommand.kt index 1df8d12f2..30b2c6201 100644 --- a/src/main/kotlin/ml/duncte123/skybot/commands/music/RadioCommand.kt +++ b/src/main/kotlin/ml/duncte123/skybot/commands/music/RadioCommand.kt @@ -113,7 +113,7 @@ class RadioCommand : MusicCommand() { else -> { val radio = radioStreams.firstOrNull { it.name == args[0].replace(oldValue = "❤", newValue = "love") } if (radio == null) { - sendErrorWithMessage(event.message, event, "The stream is invalid!") + sendErrorWithMessage(event.message, "The stream is invalid!") return@executeCommand } audioUtils.loadAndPlay(mng, event.channel, radio.url, false) @@ -125,7 +125,7 @@ class RadioCommand : MusicCommand() { } } else -> { - sendErrorWithMessage(event.message, event, "The stream name is too long! Type `$PREFIX$name (full)list` for a list of available streams!") + sendErrorWithMessage(event.message, "The stream name is too long! Type `$PREFIX$name (full)list` for a list of available streams!") } } }