test.py:3: error: Argument 1 to "on_message" of "OnMessage" has incompatible type "Filter"; expected "OnMessage" [arg-type]
Found 1 error in 1 file (checked 1 source file)
it's caused by the lack of typehints in OnMessage and similar classes from pyrogram.methods.decorators:
class OnMessage:
def on_message(
self=None, # ⬅️ HERE
filters=None, # ⬅️ HERE
group: int = 0
) -> Callable:
The issue:
mypy (as well as PyLance) is complaining when @Client.on_... is used w/ filters
Reproducing: create a
test.py
filecheck it w/ mypy:
the output is:
it's caused by the lack of typehints in OnMessage and similar classes from pyrogram.methods.decorators:
the applied fix:
verification w/ mypy: