Forums

How can I make an automatic restart for Telegram Bot?

I am using the pyTelegramBotAPI library to create my bot. The bot has been running for less than 3 days because, as I understand it, the pythonanywhere servers are restarting. Tried to do a restart with psutil.process_iter(), but the telegram bot, even when enabled, does not show up in the processes. Would be grateful for help in solving the problem :)

With a free account, unfortunately there's no way to do that. With a paid account, you'd be able to use an always-on task, which would run non-stop (and would restart if it exited for any reason, whether that's because there was system maintenance on our side, or if your own code had a bug that made it crash).

Thx for answering.