I am writing a bot using aiogram 3.4 library. And I encountered the following problem. I need to make a dialog between one user and another for a certain period of time. For this I need to know the id of both users. The transition to the dialog should be made after clicking on the inline button. Id of both users are stored in the database. I tried to do it via FSM, but the other user’s state will be different (reset). FSM strategy I can’t make it as GLOBAL type, because it will disturb other function.
By all means, the handler that sends messages should be in the FSM state set when the inline button is pressed. But in this case it is not clear what to do with the second user. How to pass the id data of both users to it? Maybe someone can suggest a way to copy the state data of one user to the data of the other, if it is possible? Or some other option through middleware?
The second idea I had was to hook up Redis and access the state data directly from the handler to get the id. But at the moment I don’t have a chance to try this option, if it is even feasible.
Vilgefortz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.