From ebad34cbc76bf8931714ec1af20439fbe33b81bc Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 16 Aug 2019 22:47:31 +0200 Subject: [PATCH] Fix smart-plugins.rst docs --- docs/source/topics/smart-plugins.rst | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/source/topics/smart-plugins.rst b/docs/source/topics/smart-plugins.rst index 5131f27b..7cfed47d 100644 --- a/docs/source/topics/smart-plugins.rst +++ b/docs/source/topics/smart-plugins.rst @@ -291,10 +291,9 @@ Load/Unload Plugins at Runtime In the previous section we've explained how to specify which plugins to load and which to ignore before your Client starts. Here we'll show, instead, how to unload and load again a previously registered plugin at runtime. -Each function decorated with the usual ``on_message`` decorator (or any other decorator that deals with Telegram updates -) will be modified in such a way that, when you reference them later on, they will be actually pointing to a tuple of -*(handler: Handler, group: int)*. The actual callback function is therefore stored inside the handler's *callback* -attribute. Here's an example: +Each function decorated with the usual ``on_message`` decorator (or any other decorator that deals with Telegram +updates) will be modified in such a way that a special ``handler`` attribute pointing to a tuple of +*(handler: Handler, group: int)* is attached to the function object itself. - ``plugins/handlers.py`` @@ -306,12 +305,12 @@ attribute. Here's an example: message.reply(message.text) print(echo) - print(echo[0].callback) + print(echo.handler) -- Printing ``echo`` will show something like ``(, 0)``. +- Printing ``echo`` will show something like ````. -- Printing ``echo[0].callback``, that is, the *callback* attribute of the first element of the tuple, which is an - Handler, will reveal the actual callback ````. +- Printing ``echo.handler`` will reveal the handler, that is, a tuple containing the actual handler and the group it + was registered on ``(, 0)``. Unloading ^^^^^^^^^