MessageHandler¶
There is base class for message handlers.
Simple usage¶
from aiogram.handlers import MessageHandler
...
@router.message()
class MyHandler(MessageHandler):
async def handle(self) -> Any:
return SendMessage(chat_id=self.chat.id, text="PASS")
Extension¶
This base handler is subclass of BaseHandler with some extensions:
self.chat
is alias forself.event.chat
self.from_user
is alias forself.event.from_user