mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Remove filters from class based handlers
This commit is contained in:
parent
acbe1f81b6
commit
647d03b2d4
5 changed files with 1 additions and 16 deletions
|
|
@ -17,8 +17,6 @@ Import: `#!python3 from aiogram.hanler import BaseHandler`
|
|||
|
||||
By default you will need to override only method `#!python3 async def handle(self) -> Any: ...`
|
||||
|
||||
The list of filters can be specified in attribute `#!python3 filters: Union[List["FilterType"], Tuple["FilterType"]]` or you can combine that attribute with filters specified in event registerer (via decorator or observer method)
|
||||
|
||||
This class is also have an default initializer and you don't need to change it.
|
||||
Initializer accepts current event and all contextual data and which can be accessed from the handler through attributes: `event: TelegramEvent` and `data: Dict[Any, str]`
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ from aiogram.handlers import MessageHandler
|
|||
|
||||
@router.message_handler()
|
||||
class MyTestMessageHandler(MessageHandler):
|
||||
filters = [Text(text="test")]
|
||||
|
||||
async def handle() -> Any:
|
||||
return SendMessage(chat_id=self.chat.id, text="PASS")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue