aiogram/docs/dispatcher/class_based_handlers/poll.md

29 lines
574 B
Markdown
Raw Normal View History

2020-01-21 23:33:44 +02:00
# 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)