diff --git a/aiogram/dispatcher/filters/builtin.py b/aiogram/dispatcher/filters/builtin.py index 8b739989..0cb41544 100644 --- a/aiogram/dispatcher/filters/builtin.py +++ b/aiogram/dispatcher/filters/builtin.py @@ -393,11 +393,10 @@ class ExceptionsFilter(BoundFilter): key = 'exception' - def __init__(self, dispatcher, exception): - super().__init__(dispatcher) + def __init__(self, exception): self.exception = exception - async def check(self, dispatcher, update, exception): + async def check(self, update, exception): try: raise exception except self.exception: diff --git a/aiogram/dispatcher/filters/filters.py b/aiogram/dispatcher/filters/filters.py index 816f4722..7c0203f2 100644 --- a/aiogram/dispatcher/filters/filters.py +++ b/aiogram/dispatcher/filters/filters.py @@ -3,7 +3,6 @@ import inspect import typing from ..handler import Handler -from ...types.base import TelegramObject class FilterNotPassed(Exception): @@ -140,8 +139,8 @@ class AbstractFilter(abc.ABC): """ pass - async def __call__(self, obj: TelegramObject) -> bool: - return await self.check(obj) + async def __call__(self, *args) -> bool: + return await self.check(*args) def __invert__(self): return NotFilter(self) diff --git a/examples/middleware_and_antiflood.py b/examples/middleware_and_antiflood.py index 7986bf3f..c579aecc 100644 --- a/examples/middleware_and_antiflood.py +++ b/examples/middleware_and_antiflood.py @@ -46,7 +46,7 @@ class ThrottlingMiddleware(BaseMiddleware): self.prefix = key_prefix super(ThrottlingMiddleware, self).__init__() - async def on_process_message(self, message: types.Message): + async def on_process_message(self, message: types.Message, data: dict): """ This handler is called when dispatcher receives a message