Document how decorated functions are modified

This commit is contained in:
Dan 2018-12-15 09:10:19 +01:00
parent 2ae8730b22
commit 6a9c7312cc
5 changed files with 35 additions and 0 deletions

View File

@ -27,6 +27,13 @@ class OnCallbackQuery(BaseClient):
callback queries. This does the same thing as :meth:`add_handler` using the
:class:`CallbackQueryHandler`.
.. note::
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
To reference your own function after it has been decorated, you need to access
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
first element in the tuple.
Args:
filters (:obj:`Filters <pyrogram.Filters>`):
Pass one or more filters to allow only a subset of callback queries to be passed

View File

@ -27,6 +27,13 @@ class OnDeletedMessages(BaseClient):
deleted messages. This does the same thing as :meth:`add_handler` using the
:class:`DeletedMessagesHandler`.
.. note::
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
To reference your own function after it has been decorated, you need to access
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
first element in the tuple.
Args:
filters (:obj:`Filters <pyrogram.Filters>`):
Pass one or more filters to allow only a subset of messages to be passed

View File

@ -27,6 +27,13 @@ class OnMessage(BaseClient):
messages. This does the same thing as :meth:`add_handler` using the
:class:`MessageHandler`.
.. note::
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
To reference your own function after it has been decorated, you need to access
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
first element in the tuple.
Args:
filters (:obj:`Filters <pyrogram.Filters>`):
Pass one or more filters to allow only a subset of messages to be passed

View File

@ -26,6 +26,13 @@ class OnRawUpdate(BaseClient):
raw updates. This does the same thing as :meth:`add_handler` using the
:class:`RawUpdateHandler`.
.. note::
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
To reference your own function after it has been decorated, you need to access
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
first element in the tuple.
Args:
group (``int``, *optional*):
The group identifier, defaults to 0.

View File

@ -27,6 +27,13 @@ class OnUserStatus(BaseClient):
user status updates. This does the same thing as :meth:`add_handler` using the
:class:`UserStatusHandler`.
.. note::
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
To reference your own function after it has been decorated, you need to access
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
first element in the tuple.
Args:
filters (:obj:`Filters <pyrogram.Filters>`):
Pass one or more filters to allow only a subset of UserStatus updated to be passed in your function.