i am currently working on this discord bot but when i call a command it responds twice. would anyone know how to fix this?
JavaScript
x
17
17
1
bot.on('message', async message => {
2
3
let prefix = config.prefix;
4
let messageArray = message.content.split(' ');
5
let command = messageArray[0];
6
let args = messageArray.slice(1);
7
const { MessageEmbed } = require('discord.js');
8
9
if (command === `${prefix}hit`) {
10
let user2 = `${args}`
11
if (user2 === '')
12
user2 = `${bot.user.username}`
13
let user1 = message.author
14
message.reply(`hit you ${user2} n https://media.giphy.com/media/43bOrDOasXG6Y/giphy.gif`)
15
}
16
})
17
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