Skip to content

Commit

Permalink
add note to enable server members intent, and backup loadpath
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 24, 2020
1 parent 926afad commit 2ced740
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ dDiscordBot: Adds a Discord Bot to Denizen!

Only works if you know how to operate a Discord bot, of course! https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token

It's strongly recommended you enable the `Server Members Intent` in the Discord bot settings.

#### Need help using dDiscordBot? Try one of these places:

**Discord:** https://discord.gg/Q6pZGSR
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/com/denizenscript/ddiscordbot/DiscordCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,18 @@ public static class DiscordConnectThread extends Thread {
@Override
public void run() {
try {
JDA jda = JDABuilder.createDefault(code).enableIntents(GatewayIntent.GUILD_MEMBERS, GatewayIntent.GUILD_MESSAGES).setMemberCachePolicy(MemberCachePolicy.ALL).build();
conn.client = jda;
jda.awaitReady();
try {
// Try with intents
JDA jda = JDABuilder.createDefault(code).enableIntents(GatewayIntent.GUILD_MEMBERS, GatewayIntent.GUILD_MESSAGES).setMemberCachePolicy(MemberCachePolicy.ALL).build();
conn.client = jda;
jda.awaitReady();
}
catch (Exception ex) {
// If startup failure, try without intents
JDA jda = JDABuilder.createDefault(code).build();
conn.client = jda;
jda.awaitReady();
}
conn.registerHandlers();
}
catch (Exception ex) {
Expand Down

0 comments on commit 2ced740

Please sign in to comment.