Help Discord Bot Replying Twice!

My discord bot has been making tasks done twice, Ive done tests and it looks like multiple consoles that are doing nodemon bot.js (A NPM Package that auto restarts when code is edited) looks like there’s a console that I closed and still running, Any help or someway to kill ALL CONSOLES and do a complete restart?

Did you resolve this? You seem to have removed the post saying you did.

Im not sure. Im getting weird results and found a kind of loop hole. What im doing is that I started nodemon (a program that restarts when code is changed) and I do !kill ( A kill switch) On the console it says app crashed restarting… then I close the console and my bot Is working 24/7 always on but responds twice.

Nodemon is about to start —> I close it —> Did !kill —> Nodemon crashes and will restart when something changed —> I edit code and it starts 2 nodemon processes —> bot never stops and stays forever running.

Why are you using nodemon? Glitch already restarts when code is changed (unless overridden by watch.json file settings). I wonder if that could be causing your issue.

I killed all processes using killall node. I may have fixed 1 problem.

And my code doesnt restart when changes happen what node mon does is Check for code updates then once it found code updates it does node bot.js and restarts the bot.

I’m not understanding the benefit - Glitch will do the same if you put ‘node bot.js’ as your start command in package.json as that gets called on restart.

Oh. I see i didnt know that.

Hello i am having the same problem for making my discord js bot code like this is sending pong pong when i type ping instead of pong one time any ideas on why

// Import the discord.js module

const Discord = require(‘discord.js’);

// Create an instance of a Discord client

const client = new Discord.Client();


  • The ready event is vital, it means that only after this will your bot start reacting to information

  • received from Discord


client.on(‘ready’, () => {

console.log(‘I am ready!’);


// Create an event listener for messages

client.on(‘message’, message => {

// If the message is “ping”

if (message.content === ‘ping’) {

// Send "pong" to the same channel'pong');



// Log our bot in using the token from


Please dont show the token that you are using, i recommend to change that now.

I already changed it before sending it

1 Like

So anyone have ideas on why this is happening

Okay guys after a 12 hour battle I have figured it out. On windows you have cmd and powershell. I would recommend stopping powershell because i think it was running through both platforms hence 2 messages. Now it will only run through cmd so one message