mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
More class based handlers
This commit is contained in:
parent
b144332287
commit
895b727ddf
24 changed files with 506 additions and 30 deletions
29
docs/dispatcher/class_based_handlers/callback_query.md
Normal file
29
docs/dispatcher/class_based_handlers/callback_query.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# CallbackQueryHandler
|
||||
|
||||
There is base class for callback query handlers.
|
||||
|
||||
## Simple usage:
|
||||
```pyhton3
|
||||
from aiogram.handlers import CallbackQueryHandler
|
||||
|
||||
...
|
||||
|
||||
@router.callback_query_handler()
|
||||
class MyHandler(CallbackQueryHandler):
|
||||
async def handle(self) -> Any: ...
|
||||
|
||||
```
|
||||
|
||||
## Extension
|
||||
|
||||
This base handler is subclass of [BaseHandler](basics.md#basehandler) with some extensions:
|
||||
|
||||
- `self.from_user` is alias for `self.event.from_user`
|
||||
- `self.message` is alias for `self.event.message`
|
||||
- `self.callback_data` is alias for `self.event.data`
|
||||
|
||||
## Related pages
|
||||
|
||||
- [BaseHandler](basics.md#basehandler)
|
||||
- [CallbackQuery](../../api/types/callback_query.md)
|
||||
- [Router.callback_query_handler](../router.md#callback-query)
|
||||
Loading…
Add table
Add a link
Reference in a new issue