Fix GUILD_MEMBERS intent not getting auto enabled

This commit is contained in:
Vankka 2023-06-18 23:44:00 +03:00
parent 1586fcb927
commit 6de141ea1d
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0

View File

@ -311,10 +311,8 @@ public class JDAConnectionManager implements DiscordConnectionManager {
MemberCachingConfig memberCachingConfig = discordSRV.config().memberCaching; MemberCachingConfig memberCachingConfig = discordSRV.config().memberCaching;
DiscordConnectionDetailsImpl connectionDetails = discordSRV.discordConnectionDetails(); DiscordConnectionDetailsImpl connectionDetails = discordSRV.discordConnectionDetails();
Set<GatewayIntent> intents = new LinkedHashSet<>();
this.intents.clear(); this.intents.clear();
this.intents.addAll(connectionDetails.getGatewayIntents()); this.intents.addAll(connectionDetails.getGatewayIntents());
this.intents.forEach(intent -> intents.add(intent.asJDA()));
Set<CacheFlag> cacheFlags = new LinkedHashSet<>(); Set<CacheFlag> cacheFlags = new LinkedHashSet<>();
this.cacheFlags.clear(); this.cacheFlags.clear();
@ -323,7 +321,7 @@ public class JDAConnectionManager implements DiscordConnectionManager {
cacheFlags.add(flag.asJDA()); cacheFlags.add(flag.asJDA());
DiscordGatewayIntent intent = flag.requiredIntent(); DiscordGatewayIntent intent = flag.requiredIntent();
if (intent != null) { if (intent != null) {
intents.add(intent.asJDA()); this.intents.add(intent);
} }
}); });
@ -355,6 +353,9 @@ public class JDAConnectionManager implements DiscordConnectionManager {
chunkingFilter = ChunkingFilter.NONE; chunkingFilter = ChunkingFilter.NONE;
} }
Set<GatewayIntent> intents = new LinkedHashSet<>();
this.intents.forEach(intent -> intents.add(intent.asJDA()));
// Start with everything disabled & enable stuff that we actually need // Start with everything disabled & enable stuff that we actually need
JDABuilder jdaBuilder = JDABuilder.createLight(token, intents); JDABuilder jdaBuilder = JDABuilder.createLight(token, intents);
jdaBuilder.enableCache(cacheFlags); jdaBuilder.enableCache(cacheFlags);