Help Discord Bot Replying Twice!


#1

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?


#3

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


#4

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.


#5

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.


#6

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.


#7

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.


#8

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.


#9

Oh. I see i didnt know that.