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
28
docs/dispatcher/class_based_handlers/poll.md
Normal file
28
docs/dispatcher/class_based_handlers/poll.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# PollHandler
|
||||
|
||||
There is base class for poll handlers.
|
||||
|
||||
## Simple usage:
|
||||
```pyhton3
|
||||
from aiogram.handlers import PollHandler
|
||||
|
||||
...
|
||||
|
||||
@router.poll_handler()
|
||||
class MyHandler(PollHandler):
|
||||
async def handle(self) -> Any: ...
|
||||
|
||||
```
|
||||
|
||||
## Extension
|
||||
|
||||
This base handler is subclass of [BaseHandler](basics.md#basehandler) with some extensions:
|
||||
|
||||
- `self.question` is alias for `self.event.question`
|
||||
- `self.options` is alias for `self.event.options`
|
||||
|
||||
## Related pages
|
||||
|
||||
- [BaseHandler](basics.md#basehandler)
|
||||
- [Poll](../../api/types/poll.md)
|
||||
- [Router.poll_handler](../router.md#poll)
|
||||
Loading…
Add table
Add a link
Reference in a new issue