Skip to content

Commit ebad34c

Browse files
committed
Fix smart-plugins.rst docs
1 parent af24411 commit ebad34c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

docs/source/topics/smart-plugins.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,9 @@ Load/Unload Plugins at Runtime
291291
In the previous section we've explained how to specify which plugins to load and which to ignore before your Client
292292
starts. Here we'll show, instead, how to unload and load again a previously registered plugin at runtime.
293293

294-
Each function decorated with the usual ``on_message`` decorator (or any other decorator that deals with Telegram updates
295-
) will be modified in such a way that, when you reference them later on, they will be actually pointing to a tuple of
296-
*(handler: Handler, group: int)*. The actual callback function is therefore stored inside the handler's *callback*
297-
attribute. Here's an example:
294+
Each function decorated with the usual ``on_message`` decorator (or any other decorator that deals with Telegram
295+
updates) will be modified in such a way that a special ``handler`` attribute pointing to a tuple of
296+
*(handler: Handler, group: int)* is attached to the function object itself.
298297

299298
- ``plugins/handlers.py``
300299

@@ -306,12 +305,12 @@ attribute. Here's an example:
306305
message.reply(message.text)
307306
308307
print(echo)
309-
print(echo[0].callback)
308+
print(echo.handler)
310309
311-
- Printing ``echo`` will show something like ``(<MessageHandler object at 0x10e3abc50>, 0)``.
310+
- Printing ``echo`` will show something like ``<function echo at 0x10e3b6598>``.
312311

313-
- Printing ``echo[0].callback``, that is, the *callback* attribute of the first element of the tuple, which is an
314-
Handler, will reveal the actual callback ``<function echo at 0x10e3b6598>``.
312+
- Printing ``echo.handler`` will reveal the handler, that is, a tuple containing the actual handler and the group it
313+
was registered on ``(<MessageHandler object at 0x10e3abc50>, 0)``.
315314

316315
Unloading
317316
^^^^^^^^^

0 commit comments

Comments
 (0)