Answer the question
In order to leave comments, you need to log in
How to properly implement a telegram bot that is based on a dialogue?
I wonder how to implement a bot whose responses depend on the current state.
For example, the first stage is the choice of topics, the bot displays buttons with a choice.
The second stage is uploading a picture, the bot expects a photo from the user.
The third stage is the text. The bot expects the text of the article from 180 characters.
And each of these stages is isolated, in the second stage you cannot upload a theme, and in the third stage you cannot upload an image.
I roughly imagined that this can be implemented through a state machine, that the user has his own state at the time, but maybe there is some kind of canonical solution?
Answer the question
In order to leave comments, you need to log in
And why does FSM not suit you? You can try to reinvent your wheel, of course, but I'm afraid it will hurt FSM, it looks like
PS: You can just try to record the current stage of the user in a radish or somewhere else and check it everywhere
aiogram comes with its own FSM, python-telegram-bot also comes with its own FSM and context store. When writing, you will need to attach a state value to the handlers.
Here is an example for python-telegram-bot: https://github.com/python-telegram-bot/python-tele...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question