diff --git a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java index 5e6dca1d..3cec098b 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java +++ b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java @@ -252,7 +252,17 @@ public class VelocityCore implements ReloadablePlugin { @Override public void onProxyShutdown(ProxyShutdownEvent event) { try { - DiscordBot.withBot(bot -> bot.getJda().shutdownNow()); + DiscordBot.withBot(bot -> { + bot.getJda().shutdownNow(); + bot.getJda().getHttpClient().connectionPool().evictAll(); + bot.getJda().getHttpClient().dispatcher().executorService().shutdown(); + try { + if(!bot.getJda().awaitShutdown(1, TimeUnit.SECONDS)) + logger.log(Level.SEVERE, "Could not await discord bot shutdown"); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + }); } catch (Throwable e) { logger.log(Level.SEVERE, "Could not shutdown discord bot", e); } diff --git a/VelocityCore/src/de/steamwar/velocitycore/discord/DiscordBot.java b/VelocityCore/src/de/steamwar/velocitycore/discord/DiscordBot.java index 89167565..d2f7419a 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/discord/DiscordBot.java +++ b/VelocityCore/src/de/steamwar/velocitycore/discord/DiscordBot.java @@ -97,7 +97,7 @@ public class DiscordBot { .createDefault(config.getToken()) .setStatus(OnlineStatus.ONLINE) .setMemberCachePolicy(MemberCachePolicy.ONLINE) - .enableIntents(GatewayIntent.MESSAGE_CONTENT) + .enableIntents(GatewayIntent.GUILD_MEMBERS, GatewayIntent.MESSAGE_CONTENT) .build(); instance = this; diff --git a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java index 6a949d0b..7c86c1b0 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java @@ -48,7 +48,7 @@ public class CouncilChannel extends StaticMessageChannel { MessageCreateBuilder messageCreateBuilder = new MessageCreateBuilder(); messageCreateBuilder.setContent("# Ratsmitglieder"); - for (Member member : DiscordBot.getGuild().getMembersWithRoles(role)) { + for (Member member : DiscordBot.getGuild().findMembersWithRoles(role).get()) { SteamwarUser steamwarUser = SteamwarUser.get(member.getIdLong()); if (steamwarUser == null) continue;