so I made a Discord bot, the welcome message was working for the first 3 months or so but suddenly it stopped working, can I asks why? I had been searching as to why it does not work but I couldn’t find why. Thank You before.
client.on('guildMemberAdd', member => { const channel = member.guild.channels.find( ch => ch.name === '•chat-kalem•' ); const redirch = member.guild.channel.cache.find(ch => ch.name === "•rules•"); channel.send(`Welcome, ${member}! Please read the ${redirch} first.`); });
Advertisement
Answer
Hey there your issue is because of recent gateway changes of the Discord Api that you need to enable the intents here is a fix for you –
- Head over to Discord Developers Portal
- Choose your application
- Inside the
bot
section if yiu scroll a little bit down , you will see a section namedPrivileged Gateway Intents
- Enable the
SERVER MEMBERS INTENT
and restart the bot and your bot will start recieving theguildMemberAdd
event!
Learn more about intents at Discord.js