Skip to content
Advertisement

discord bot replies 1 to 2 times

i am currently working on this discord bot but when i call a command it responds twice. would anyone know how to fix this?

bot.on('message', async message => {

  let prefix = config.prefix;
  let messageArray = message.content.split(' ');
  let command = messageArray[0];
  let args = messageArray.slice(1);
  const { MessageEmbed } = require('discord.js');

  if (command === `${prefix}hit`) {
    let user2 = `${args}`
    if (user2 === '')
      user2 = `${bot.user.username}`
    let user1 = message.author
    message.reply(`hit you ${user2} n https://media.giphy.com/media/43bOrDOasXG6Y/giphy.gif`)
}
})

Advertisement

Answer

Have you tried shutting down all other processes of your bot (Google Cloud, AWS …)?
The bot could login twice and act like 2 bots, replying twice to the command

Happened to me once

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement