Reputation: 98
I just started programming a new Discord bot for myself to see what I am able to create. Currently, I'm working on an Autorole feature but I just don't get why the Bot doesn't get triggered by a MemberJoinEvent. Here is my code:
gateway.getEventDispatcher().on(MemberJoinEvent.class).subscribe(memberJoinEvent -> {
final Member member = memberJoinEvent.getMember();
System.out.println(member.toString());
});
Upvotes: 1
Views: 335
Reputation: 272
In addition to leguans answer, I also had to request the gateway intents as well!
GatewayDiscordClient gatewayDiscordClient() {
return discordClient()
.gateway()
.setEnabledIntents(IntentSet.all())
.login()
.block();
}
https://docs.discord4j.com/migrating-from-v3-1-to-v3-2/#gateway-intents
Upvotes: 0
Reputation: 98
I found the problem! I didnt know that discord changed something in their developer portal. Also I used my old project so I didnt notice it. You have to manualy enable it in the developer portal, that the bot can access member information. A screenshot of the location to enable the gateway feature
Upvotes: 1