Tishka17 / aiogram_dialog

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

Флуд и UnknownIntent #173

Open ddenzer opened 2 years ago

ddenzer commented 2 years ago

При флуде инлайн клавиатуры плюет исключение aiogram_dialog.exceptions.UnknownIntent: Context not found for intent id: Z7ZjG2

events_isolation не помогает

aiogram3 v2.0.0b7

RuslanZaliznyak commented 1 year ago

Is there any way to resize the buttons in "Multiselect" so that you can write long text?

Sonotoki-da commented 1 year ago

Just found out that if you comment the class IntentErrorMiddleware out in registry.py in the library's manager folder (169-173 lines), you'll start to get actual errors from where you did a mistake. In my case, I was sending a None type object instead of a list object in the getter to feed a Select widget with Buttons, thus got a related error message:

  File "/home/diejoeboo/Documents/VSCode/mybot/venv/lib/python3.10/site-packages/aiogram_dialog/widgets/kbd/select.py", line 72, in _render_keyboard
    for pos, item in enumerate(self.items_getter(data))
TypeError: 'NoneType' object is not iterable

instead of:

  File "/home/diejoeboo/Documents/VSCode/mybot/venv/lib/python3.10/site-packages/aiogram_dialog/context/storage.py", line 35, in load_context
    raise UnknownIntent(
aiogram_dialog.api.exceptions.UnknownIntent: Context not found for intent id: wLPzka

@Tishka17, maybe because of this generated window with wrong keyboard layout, we can't use the window after restarting the bot? At some point, I couldn't get buttons to work in the old window after restarting the bot, and of course, I'm using redis for the storage. But it was working like a charm until my project code grow in the numbers and became more complex with a couple more of ifs in the getters. I should check my code thoroughly first though, because I feel like I messed up somewhere.

My environment settings for reference: Python:

Python 3.10.6 (main, Aug  3 2022, 17:39:45) [GCC 12.1.1 20220730] on linux

aiogram and aiogram_dialog:

aiogram==3.0.0b5
aiogram-dialog==2.0.0b11

Redis and Postgresql:

Redis 7.0.4 (00000000/0) 64 bit
postgres (PostgreSQL) 14.5

Anyways, thank you guys for creating this amazing library! I'm loving it!