can show the code?
To have some kind of layer between the bot and the service, which stores the states and switches them.
You can save the state of the user in a storage like Redis or a database. And whenever you have a new update, retrieve the state from the storage and run logics accordingly.
https://github.com/telegraf/telegraf/blob/v4/src/scenes/stage.ts#L45
you can do it with scenes in telegraf
if your are using JS/TS
Using Java Spring)))
you can use and FSM library that can allow you to store states in caching system like redis or in database
I heard about Spring state machine. I know what is Redis, but never used it.
Обсуждают сегодня