mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +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'
|
key = 'exception'
|
||||||
|
|
||||||
def __init__(self, dispatcher, exception):
|
def __init__(self, exception):
|
||||||
super().__init__(dispatcher)
|
|
||||||
self.exception = exception
|
self.exception = exception
|
||||||
|
|
||||||
async def check(self, dispatcher, update, exception):
|
async def check(self, update, exception):
|
||||||
try:
|
try:
|
||||||
raise exception
|
raise exception
|
||||||
except self.exception:
|
except self.exception:
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import inspect
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from ..handler import Handler
|
from ..handler import Handler
|
||||||
from ...types.base import TelegramObject
|
|
||||||
|
|
||||||
|
|
||||||
class FilterNotPassed(Exception):
|
class FilterNotPassed(Exception):
|
||||||
|
|
@ -140,8 +139,8 @@ class AbstractFilter(abc.ABC):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def __call__(self, obj: TelegramObject) -> bool:
|
async def __call__(self, *args) -> bool:
|
||||||
return await self.check(obj)
|
return await self.check(*args)
|
||||||
|
|
||||||
def __invert__(self):
|
def __invert__(self):
|
||||||
return NotFilter(self)
|
return NotFilter(self)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class ThrottlingMiddleware(BaseMiddleware):
|
||||||
self.prefix = key_prefix
|
self.prefix = key_prefix
|
||||||
super(ThrottlingMiddleware, self).__init__()
|
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
|
This handler is called when dispatcher receives a message
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue