Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  104] [ 4]  / answers: 1 / hits: 19430  / 4 Years ago, sat, october 31, 2020, 12:00:00

I have a code where if someone joins the bot gives a welcome message but when a user joins, the bot does not give the welcome message.


Code:


bot.on('guildMemberAdd', member => {

const channel = member.guild.channels.cache.find(channel => channel.name === "general")
if (!channel) return;

const joinembed = new Discord.MessageEmbed()
.setTitle(`A new member just arrived!`)
.setDescription(`Welcome ${member} we hope you enjoy your stay here!`)
.setColor("#FF0000")

channel.send(joinembed)
});

My bot has all the permissions and is at the very top of the role hierarchy, please help I don't know what am I doing wrong. This problem also applies when the user leaves (It also does not give the welcome message)


More From » node.js

 Answers
42

Discord made some changes a few days ago. The bot is not sending the welcome message because it never gets the guildMemberAdd event. From now on to get these types of events you will have to turn the intents on in the dev portal. After doing this your code will start working again.


dev


[#50572] Wednesday, October 14, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
georginaariao

Total Points: 626
Total Questions: 112
Total Answers: 112

Location: Burkina Faso
Member since Thu, Dec 15, 2022
1 Year ago
;