Skip to content

Commit 6a9c731

Browse files
committed
Document how decorated functions are modified
1 parent 2ae8730 commit 6a9c731

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

pyrogram/client/methods/decorators/on_callback_query.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ def on_callback_query(self=None, filters=None, group: int = 0):
2727
callback queries. This does the same thing as :meth:`add_handler` using the
2828
:class:`CallbackQueryHandler`.
2929
30+
.. note::
31+
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
32+
33+
To reference your own function after it has been decorated, you need to access
34+
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
35+
first element in the tuple.
36+
3037
Args:
3138
filters (:obj:`Filters <pyrogram.Filters>`):
3239
Pass one or more filters to allow only a subset of callback queries to be passed

pyrogram/client/methods/decorators/on_deleted_messages.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ def on_deleted_messages(self=None, filters=None, group: int = 0):
2727
deleted messages. This does the same thing as :meth:`add_handler` using the
2828
:class:`DeletedMessagesHandler`.
2929
30+
.. note::
31+
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
32+
33+
To reference your own function after it has been decorated, you need to access
34+
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
35+
first element in the tuple.
36+
3037
Args:
3138
filters (:obj:`Filters <pyrogram.Filters>`):
3239
Pass one or more filters to allow only a subset of messages to be passed

pyrogram/client/methods/decorators/on_message.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ def on_message(self=None, filters=None, group: int = 0):
2727
messages. This does the same thing as :meth:`add_handler` using the
2828
:class:`MessageHandler`.
2929
30+
.. note::
31+
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
32+
33+
To reference your own function after it has been decorated, you need to access
34+
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
35+
first element in the tuple.
36+
3037
Args:
3138
filters (:obj:`Filters <pyrogram.Filters>`):
3239
Pass one or more filters to allow only a subset of messages to be passed

pyrogram/client/methods/decorators/on_raw_update.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ def on_raw_update(self=None, group: int = 0):
2626
raw updates. This does the same thing as :meth:`add_handler` using the
2727
:class:`RawUpdateHandler`.
2828
29+
.. note::
30+
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
31+
32+
To reference your own function after it has been decorated, you need to access
33+
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
34+
first element in the tuple.
35+
2936
Args:
3037
group (``int``, *optional*):
3138
The group identifier, defaults to 0.

pyrogram/client/methods/decorators/on_user_status.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ def on_user_status(self=None, filters=None, group: int = 0):
2727
user status updates. This does the same thing as :meth:`add_handler` using the
2828
:class:`UserStatusHandler`.
2929
30+
.. note::
31+
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
32+
33+
To reference your own function after it has been decorated, you need to access
34+
*my_function[0].callback*, that is, the *callback* field of Handler object which is the the
35+
first element in the tuple.
36+
3037
Args:
3138
filters (:obj:`Filters <pyrogram.Filters>`):
3239
Pass one or more filters to allow only a subset of UserStatus updated to be passed in your function.

0 commit comments

Comments
 (0)