Warn about using F
from magic_filter
instead of aiogram
one
#990
Labels
3.x
Issue or PR for stable 3.x version
new feature
Missing feature
under discussion
A subject of discussion
Milestone
Problem
Sometimes people may be confused why the filter won't pass when they have
.as_("arg")
at the end ofF
-expression. The reason is they usefrom magic_filter import F
instead offrom aiogram import F
. The one that provided by aiogram has an additional method.as_(key: str)
that is useful only with aiogram filters: it returns a dictionary if the filter passes, then the result is added to handler kwargs by aiogram.Possible solution
Throw a warning if the user is using
F
provided bymagic_filter
Adding an
isinstance(self.callback, aiogram.utils.MagicFilter)
check here would be enoughaiogram/aiogram/dispatcher/event/handler.py
Lines 50 to 56 in e7cee43
Alternatives
No response
Code example
Additional information
No response
The text was updated successfully, but these errors were encountered: