Ask coding questions

← Back to all posts
Discord bot shutdown at midnight
danyroza (0)


I have simple bot running on with Flask server running, so it "keeps it alive". But every morning, the script looks like it stopped working for some reason. I have monitor set up, so it can ping the server, which looks just fine, but when I look on, I can clearly see that the bot is down and stopped. Is there any way to keep my bot alive 24/7?

Thank you.

Thank you all for contributions, the error was much simpler (and probably dumber). I had 1 input() in the script, so when it restarted, it did not recieve this input. So I simply had to credate .env file and with os.getenv() fetch variables that I would otherwise input manually.

Answered by RohilPatel (1534) [earned 5 cycles]
View Answer
RohilPatel (1534)

Well there is two reasons:

  • Either your code breaks, because something hasn't been handled or something
  • You haven't hooked it up to uptime robot
  • Something is goofy with repl, I've had that happen before
danyroza (0)

@RohilPatel Since I did not handle input properly, I believe that this comment is closest to the solution.


try using uptimers. They work 100%. But you can also get hacker plan, which has the always on feature.

danyroza (0)

@RYANTADIPARTHI Well I am using Uptimerobot monitor and my script still sometimes just stops. Even though on the uptimerobot I see the server running, the script process does not work.

helloyanis (11)

Is there an error message on the console? If not i think you didnt setup uptime robot properly. Here is how to do it!. However if there is an error message, the problem comes from your code.