mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Fix filters.
This commit is contained in:
parent
c153fcfe8d
commit
2e2d9ea433
3 changed files with 5 additions and 7 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue