0

I recently updated my discord.js version from v12 to v13.3.1 and the 'guildMemberAdd' event stopped working, although I enabled PRESENCE INTENT as well as SERVER MEMBERS INTENT on my application.

const Discord = require('discord.js');

const client = new Discord.Client({ intents: [Discord.Intents.FLAGS.GUILD_MESSAGES, Discord.Intents.FLAGS.GUILDS] });


client.once('ready', () => {
    console.log(client.user.tag + ' is online!');
});

client.on("guildMemberAdd", guildMember => {
    let welcomeRole = guildMember.guild.roles.cache.find(role => role.name === 'member');
    guildMember.roles.add(welcomeRole);
});
MisterCH
  • 1
  • 2
  • You'll need to add the `GUILD_MEMBERS` intent too. – Zsolt Meszaros Dec 18 '21 at 21:12
  • 1
    Does this answer your question? [None of my discord.js guildmember events are emitting, my user caches are basically empty, and my functions are timing out?](https://stackoverflow.com/questions/64559390/none-of-my-discord-js-guildmember-events-are-emitting-my-user-caches-are-basica) – Zsolt Meszaros Dec 18 '21 at 21:13
  • 1
    Thank you Zsolt Meszaros now it works – MisterCH Dec 18 '21 at 21:34
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 28 '21 at 06:24

1 Answers1

0
const client = new Client({ intents: [Intents.FLAGS.GUILDS ,Intents.FLAGS.GUILD_MESSAGES,Intents.FLAGS.GUILD_MEMBERS] });

https://discord.com/developers/applications

新Acesyyy
  • 1,152
  • 1
  • 3
  • 22
Ali 43
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Ethan Jun 25 '22 at 21:57