From a60baad6f3840970e3017f7f46bd3719e28b6896 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 16 May 2025 17:50:56 +0700 Subject: [PATCH] feat: `.console discord ` --- build-number.txt | 2 +- .../chomens_bot/commands/ConsoleCommand.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/build-number.txt b/build-number.txt index 1d97f1e7..60be2614 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -3205 \ No newline at end of file +3207 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/commands/ConsoleCommand.java b/src/main/java/me/chayapak1/chomens_bot/commands/ConsoleCommand.java index 78d30f6b..b5164f63 100644 --- a/src/main/java/me/chayapak1/chomens_bot/commands/ConsoleCommand.java +++ b/src/main/java/me/chayapak1/chomens_bot/commands/ConsoleCommand.java @@ -18,6 +18,7 @@ public class ConsoleCommand extends Command { "console", new String[] { "server ", + "discord ", "logtoconsole ", "printdisconnectedreason " }, @@ -75,6 +76,21 @@ public class ConsoleCommand extends Command { ); } } + case "discord" -> { + if (Main.discord == null || Main.discord.jda == null) { + throw new CommandException(Component.translatable("commands.generic.error.discord_disabled")); + } + + final String channelId = Main.discord.findChannelId(context.bot.options.discordChannel); + + if (channelId == null) return null; + + final String message = context.getString(true, true); + + Main.discord.sendMessageInstantly(message, channelId, true); + + return null; + } case "logtoconsole" -> { context.checkOverloadArgs(2);