I created a bot with the python-telegram-bot library and the user has the ability to navigate through the states, but when there is a bug, I need to restart the bot and when I restart the bot, the user needs to type /start again in order to communicate with the bot, instead of this, is there a method that I can let the user to continue from whichever state the user was in the bot before?
Question posted in Telegram API
A comprehensive official documentation can be found here.
A comprehensive official documentation can be found here.
2
Answers
By adding a MessageHandler to entry_points in addition to CommandHandler, you can check whether the user has been in your program before and you can redirect the registered user without the need to type /start
The states of
ConversationHandler
are stored in memory by default, that’s true. If you want these states to be persisted across reboots of your python script, please have a look at PTBs built-in persistency setup.Disclaimer: I’m currently the maintainer of
python-telegram-bot
.