-1

I created a ConversationHandler function for my bot.

But the issue is I uploaded it to heroku and there my bot script is keep restarting after a specific time for that reason on every restart we need to start ConversationHandler again by sending a command and that's the problem.

So, I want to know is there any way that we store the ConversationHandler States or something on a database and load them to the script during restart so the ConversationHandler work automatically without sending any command.

Otherwise

Is there any other host website there script never restart.

BTW I am using python-telegram-bot and I have a database account on firebase

1 Answers1

0

PTB comes with a built-in persistence mechanism, see this page. To make persistence store the data to a database, you'll have to use a corresponding subclass of BasePersistence or DictPersistence. Have a look at e.g. ptbcontrib/postgres_persistence. I also found this 3rd party firebase-persistence, but the last commit is from Juni 2020, so I don't know how well it plays with the latest PTB versions.


Disclaimer: I'm currently the maintainer of python-telegram-bot

CallMeStag
  • 5,467
  • 1
  • 7
  • 22