Close discord webhook clients on shutdown (#5165)

This commit is contained in:
Josh Roy 2022-11-27 14:29:36 -05:00 committed by GitHub
parent 6e931b2b3b
commit 4414eea513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -333,7 +333,7 @@ public class JDADiscordService implements DiscordService, IEssentialsModule {
if (current != null) {
current.close();
}
channelIdToWebhook.remove(channel.getId());
channelIdToWebhook.remove(channel.getId()).close();
continue;
}
typeToChannelId.put(type, channel.getId());
@ -430,6 +430,10 @@ public class JDADiscordService implements DiscordService, IEssentialsModule {
shutdownConsoleRelay(true);
for (WebhookClient webhook : channelIdToWebhook.values()) {
webhook.close();
}
// Unregister leftover jda listeners
for (Object obj : jda.getRegisteredListeners()) {
if (!(obj instanceof EventListener)) { // Yeah bro I wish I knew too :/