fix: FINALLY fix discord ctrl+c stopping message not showing

This commit is contained in:
ChomeNS
2025-03-03 12:45:58 +07:00
parent c976878997
commit 2000662247
3 changed files with 4 additions and 3 deletions

View File

@@ -217,14 +217,14 @@ public class Main {
}
if (discordEnabled) {
discord.jda.shutdown();
for (int i = 0; i < 150; i++) {
try {
if (!ArrayUtilities.isAllTrue(stoppedDiscord)) Thread.sleep(50);
else break;
} catch (InterruptedException ignored) {}
}
discord.jda.shutdown();
}
if (callSystemExit) System.exit(exitCode);

View File

@@ -68,6 +68,7 @@ public class DiscordPlugin {
final JDABuilder builder = JDABuilder.createDefault(config.discord.token);
builder.enableIntents(GatewayIntent.MESSAGE_CONTENT);
builder.setEnableShutdownHook(false);
try {
jda = builder.build();
jda.awaitReady();