Skip to content

Commit

Permalink
Describe new event observers in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JrooTJunior committed Dec 31, 2023
1 parent d394af8 commit 1281bf5
Showing 1 changed file with 67 additions and 3 deletions.
70 changes: 67 additions & 3 deletions docs/dispatcher/router.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,77 @@ Poll answer
@router.poll_answer()
async def poll_answer_handler(poll_answer: types.PollAnswer) -> Any: pass
My chat member
--------------

.. code-block:: python
@router.my_chat_member()
async def my_chat_member_handler(my_chat_member: types.ChatMemberUpdated) -> Any: pass
Chat member
-----------

.. code-block:: python
@router.chat_member()
async def chat_member_handler(chat_member: types.ChatMemberUpdated) -> Any: pass
Chat join request
-----------------

.. code-block:: python
@router.chat_join_request()
async def chat_join_request_handler(chat_join_request: types.ChatJoinRequest) -> Any: pass
Message reaction
----------------

.. code-block:: python
@router.message_reaction()
async def message_reaction_handler(message_reaction: types.MessageReactionUpdated) -> Any: pass
Message reaction count
----------------------

.. code-block:: python
@router.message_reaction_count()
async def message_reaction_count_handler(message_reaction_count: types.MessageReactionCountUpdated) -> Any: pass
Chat boost
----------

.. code-block:: python
@router.chat_boost()
async def chat_boost_handler(chat_boost: types.ChatBoostUpdated) -> Any: pass
Remove chat boost
-----------------

.. code-block:: python
@router.removed_chat_boost()
async def removed_chat_boost_handler(removed_chat_boost: types.ChatBoostRemoved) -> Any: pass
Errors
------

.. code-block:: python
@router.errors()
async def error_handler(exception: ErrorEvent) -> Any: pass
async def error_handler(exception: types.ErrorEvent) -> Any: pass
Is useful for handling errors from other handlers, error event described :ref:`here <error-event>`

Expand All @@ -168,7 +232,7 @@ Example:

.. code-block:: python
:caption: module_1.py
:name: module_1
:name: module_1

router2 = Router()

Expand All @@ -178,7 +242,7 @@ Example:

.. code-block:: python
:caption: module_2.py
:name: module_2
:name: module_2

from module_2 import router2

Expand Down

0 comments on commit 1281bf5

Please sign in to comment.