Fix smart plugins load/unload documentation

This commit is contained in:
Dan 2019-07-11 17:13:43 +02:00
parent 8b4c326365
commit 5fe8fba3df

View File

@ -316,9 +316,9 @@ attribute. Here's an example:
Unloading Unloading
^^^^^^^^^ ^^^^^^^^^
In order to unload a plugin, or any other handler, all you need to do is obtain a reference to it by importing the In order to unload a plugin, all you need to do is obtain a reference to it by importing the relevant module and call
relevant module and call :meth:`~pyrogram.Client.remove_handler` Client's method with your function :meth:`~pyrogram.Client.remove_handler` Client's method with your function's *handler* special attribute preceded by the
name preceded by the star ``*`` operator as argument. Example: star ``*`` operator as argument. Example:
- ``main.py`` - ``main.py``
@ -328,14 +328,14 @@ name preceded by the star ``*`` operator as argument. Example:
... ...
app.remove_handler(*echo) app.remove_handler(*echo.handler)
The star ``*`` operator is used to unpack the tuple into positional arguments so that *remove_handler* will receive The star ``*`` operator is used to unpack the tuple into positional arguments so that *remove_handler* will receive
exactly what is needed. The same could have been achieved with: exactly what is needed. The same could have been achieved with:
.. code-block:: python .. code-block:: python
handler, group = echo handler, group = echo.handler
app.remove_handler(handler, group) app.remove_handler(handler, group)
Loading Loading
@ -352,4 +352,4 @@ using :meth:`~pyrogram.Client.add_handler` instead. Example:
... ...
app.add_handler(*echo) app.add_handler(*echo.handler)