Ask coding questions

← Back to all posts
Welcome Message Sends More Than Once
[deleted]

Hi there. I am making a discord.js bot, and I have added a welcome message to it. Every time I use the message, it sends one more welcome than the last time, so it ends up sending around 10 of the same messages. How do I fix this?

Code:

client.on("guildMemberAdd", (member) => {
let guild = member.guild; 
let memberTag = member.user.tag;
let guildname = guild.name 
if(guild.systemChannel){ 
	guild.systemChannel.send("Welcome, " + memberTag+ " to " + guildname+ "!");
}
});
Comments
hotnewtop
PattanAhmed (1397)

@JollyJack8 Hi,
If you thought it is a bug then feel free to post your detailed issue with pics(If you need) here, So that they can understand your issue and follow up with you there.

Hope it helps
Please mark my answer if this helps.

Coder100 (16898)

Hi! Try refreshing your token (getting a new token)

[deleted]

it still does it @Coder100

Coder100 (16898)

ah, well that's not good! I will now diagnose it with 'bug'. Report it @JollyJack8 I've actually seen this before, but usually refreshing the token did it so idk sorry

[deleted]

Alright @Coder100

HackermonDev (2007)

@JollyJack8 you should probably report it to discord.js not repl.it since they didn't make the discord.js libary

Coder100 (16898)

no no, it's repl.it thats causing it to run twice
discord.js works fine @PDanielY