From 2b775ac7e483668bd92426fa6b53f817c9b035d1 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:12:21 +0700 Subject: [PATCH] fix that might work or might does nothing or just useless --- .../chipmunk/chayapak/chomens_bot/Main.java | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java index 2c120a5..9b23541 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java @@ -130,29 +130,35 @@ public class Main { public static void initializeBots() { alreadyStarted = true; - Configuration.BotOption[] botsOptions = config.bots; + try { + Configuration.BotOption[] botsOptions = config.bots; - // idk if these should be here lol, but it is just the discord stuff - JDA jda = null; - if (config.discord.enabled) { - JDABuilder builder = JDABuilder.createDefault(config.discord.token); - builder.enableIntents(GatewayIntent.MESSAGE_CONTENT); - try { - jda = builder.build(); - jda.awaitReady(); - } catch (InterruptedException ignored) { - System.exit(1); + // idk if these should be here lol, but it is just the discord stuff + JDA jda = null; + if (config.discord.enabled) { + JDABuilder builder = JDABuilder.createDefault(config.discord.token); + builder.enableIntents(GatewayIntent.MESSAGE_CONTENT); + try { + jda = builder.build(); + jda.awaitReady(); + } catch (InterruptedException ignored) { + System.exit(1); + } + jda.getPresence().setPresence(Activity.playing(config.discord.statusMessage), false); } - jda.getPresence().setPresence(Activity.playing(config.discord.statusMessage), false); - } - for (Configuration.BotOption botOption : botsOptions) { - final Bot bot = new Bot(botOption, bots, config); - bots.add(bot); - } + for (Configuration.BotOption botOption : botsOptions) { + final Bot bot = new Bot(botOption, bots, config); + bots.add(bot); + } - // fard - new ConsolePlugin(bots, config, jda); + // fard + new ConsolePlugin(bots, config, jda); + } catch (Exception e) { + e.printStackTrace(); + + System.exit(1); + } } private static void checkInternet () throws IOException {