Home > Net >  guildMemberAdd not working Discord.js v14
guildMemberAdd not working Discord.js v14

Time:12-01

Im trying to do a blacklist bot, and when a user joins with the specific id, it gets banned.

client.on("guildMemberAdd", member => {
    member.ban({reason: "Blacklisted"})
})

I tried this on the index.js and it doesnt work.

CodePudding user response:

You will need to specify the GuildMembers intent. You said you have enabled access to the Server Members intent in the developer portal, which is the first step, but to actually recieve the events you'll need to add the GatewayIntentBits.GuildMembers intent to the array where you initialise your client.

Intents allow you to choose what events you do and don't recieve, being allowed to use a privileged intent is not the same as actually using it.

  • Related