Tishka17 / aiogram_dialog

GUI framework on top of aiogram
https://aiogram-dialog.readthedocs.io
Apache License 2.0
691 stars 103 forks source link

How get current dialog state from dialog_manager #411

Open kadyrovfriend opened 5 months ago

kadyrovfriend commented 5 months ago

Hi! Is there an easy way to get the name of dialog, or its state from dialog_manager?

So i`ve made путукфд handler for all exceptions, ocurred in my code, sending message to admin with description of error. And i need the name of dialog, so i can recreate the bug.

dialog_manager.middleware_data.raw_state was my first option, but this variable is None So I can iterate through storage to find the last state, but maybe there are easier ways to find the current state?

F0rgenet commented 4 months ago
if dialog_manager.has_context():
    current_state: State = dialog_manager.current_context().state