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.
JavaScript
x
10
10
1
client.on('guildMemberAdd', member => {
2
const channel = member.guild.channels.find(
3
ch => ch.name === '•chat-kalem•'
4
);
5
6
const redirch = member.guild.channel.cache.find(ch => ch.name === "•rules•");
7
8
channel.send(`Welcome, ${member}! Please read the ${redirch} first.`);
9
});
10
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