Forums

Will pythonanywhere disable my bot on telebot if it is idle

if anything, my bot is launched via "polling"

How do you run it?

Sorry for not responding, here's part of my code:

def main():
    while True:
        try:
            start_timemain = time.time()
            msg = f'• Bot is ready in {(time.time() - start_timemain):.2f} seconds'
            print(msg + f' at {today.strftime("%H:%M:%S %d-%m")}')
            bot.polling(none_stop=True, timeout=120)
        except Exception as e:
            traceback.print_exc()
            time.sleep(30)


if __name__ == "__main__":
    main()

Are you running it in a console?

I open the py file and run it through the code editing interface. Is there a difference?

Yes, that is in a console. We do not keep consoles running forever. We need to stop them in order to manage the service so, if that is how you run your bot, it will need to be restarted periodically. For tasks that need to run continuously, we provide always on tasks

ok, thanks

Glad to help!