My discord bots keep spamming mensages in the guildJoin event

When some one join the server, i have my bot configured to send mensage in DM and in Logs-channel, and the boot keeps spamming on those 2 channels.

Ok but what’s wrong ? Can you send some code ? Any error ? I don’t have enough elements to help you…

All code is right. This is code.

index.js: (same in my 2 bots)

  client.on("guildMemberAdd", member => {
    let commandFile = require(`./core/guildJoin.js`);, member);

Now the mensage in bot who sends on DM

const Discord = require("discord.js");
const db = require("quick.db");
const randomInt = require("random-int"); = (client, member) => {
  const memberg = member.guild;
  if (db.has(`config_${}`)) {
    if (db.get(`config_${}.jmsgS`) === "on") {


And the mensage in bot who sends on logs channel = async (client, member) => {
    const memberg = member.guild;
  if ( === "680445015423713299") {
      .send("**[ + ]** " + member + " entrou no servidor!!!");
  if ( === "566601759183863835") {
      .send("**[ + ]** " + member + " entrou no servidor!!!");

And in other bots that is hosted on glitch, it sends duplicate messages some times

When you say “spamming” you mean it really spams indefinetly or does it send the message multiple times then stops unless someone else is coming to the server ?

It send mutiple times the same message, some times is 2, other is 8 or +12.

Maybe put a console.log inside the guildMemberAdd event , one inside the DM part, and one inside the logs.

1 - If there is an issue with glitch nothing will be printed in the logs, or at least the amount of message printed in the logs will be inferior to the amount of message sent to Discord.

2 - If the guildMemberAdd event is triggered once but the DM part and logs are triggered multiple times, try checking :

  • If you accidentally trigger it twice (e.g. : When you trigger this part of the code in a loop but it should’ve been outside of it)

3 - If guildMemberAdd is triggered multiple times check :

  • If you created a second instance of the bot or not (mostly if Discord.js is required and defined 2 times)