Skip to content

Commit 077e7c0

Browse files
committed
Rename Plugins.rst to SmartPlugins.rst
1 parent 89362ef commit 077e7c0

2 files changed

Lines changed: 22 additions & 21 deletions

File tree

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ To get started, press the Next button.
8484

8585
resources/UpdateHandling
8686
resources/UsingFilters
87-
resources/Plugins
87+
resources/SmartPlugins
8888
resources/AutoAuthorization
8989
resources/CustomizeSessions
9090
resources/TgCrypto
Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
Plugins
2-
=======
1+
Smart Plugins
2+
=============
33

4-
Pyrogram embeds an **automatic** and lightweight plugin system that is meant to further simplify the organization of
5-
large projects and to provide a way for creating pluggable components that can be **easily shared** across different
4+
Pyrogram embeds a **smart** (automatic) and lightweight plugin system that is meant to further simplify the organization
5+
of large projects and to provide a way for creating pluggable components that can be **easily shared** across different
66
Pyrogram applications with **minimal boilerplate code**.
77

88
Introduction
99
------------
1010

11-
Prior to the plugin system, pluggable handlers were already possible. For instance, if you wanted to modularize your
12-
applications, you had to do something like this...
11+
Prior to the Smart Plugin system, pluggable handlers were already possible. For example, if you wanted to modularize
12+
your applications, you had to do something like this...
1313

1414
.. note:: This is an example application that replies in private chats with two messages: one containing the same
1515
text message you sent and the other containing the reversed text message (e.g.: "pyrogram" -> "pyrogram" and
@@ -61,13 +61,15 @@ manually ``import``, manually :meth:`add_handler <pyrogram.Client.add_handler>`
6161
:obj:`MessageHandler <pyrogram.MessageHandler>` object because **you can't use those cool decorators** for your
6262
functions. So... What if you could?
6363

64-
Creating Plugins
65-
----------------
64+
Using Smart Plugins
65+
-------------------
6666

67-
Setting up your Pyrogram project to accommodate plugins is as easy as creating a folder and putting your files full of
68-
handlers inside.
67+
Setting up your Pyrogram project to accommodate Smart Plugins is as easy as creating a folder and putting your files
68+
full of handlers inside.
6969

70-
.. note:: This is the same example application `as shown above <#introduction>`_, written using the plugin system.
70+
.. note::
71+
72+
This is the same example application `as shown above <#introduction>`_, written using the Smart Plugin system.
7173

7274
.. code-block:: text
7375
:emphasize-lines: 2, 3
@@ -104,14 +106,13 @@ handlers inside.
104106
Client("my_account").run()
105107
106108
The first important thing to note is the ``plugins`` folder, whose name is default and can be changed easily by setting
107-
the ``plugins_dir`` parameter when creating a :obj:`Client <pyrogram.Client>`; you can put *any python file* in the
108-
plugins folder and each file can contain *any decorated function (handlers)*. Your Pyrogram Client instance (in the
109-
``main.py`` file) will **automatically** scan the folder upon creation to search for valid handlers and register them
110-
for you.
111-
112-
Then you'll notice you can now use decorators, with only one limitation: within a single plugin file you must use
113-
different names for each decorated function. That's right, you can apply the usual decorators to your callback functions
114-
in a static way, i.e. **without having the Client instance around**: simply use ``@Client`` (Client class) instead of
115-
the usual ``@app`` (Client instance) namespace and things will work just the same.
109+
the ``plugins_dir`` parameter when creating a :obj:`Client <pyrogram.Client>`; you can put *any python file* in there
110+
and each file can contain *any decorated function* (handlers) with only one limitation: within a single plugin file you
111+
must use different names for each decorated function. Your Pyrogram Client instance (in the ``main.py`` file) will
112+
**automatically** scan the folder upon creation to search for valid handlers and register them for you.
113+
114+
Then you'll notice you can now use decorators. That's right, you can apply the usual decorators to your callback
115+
functions in a static way, i.e. **without having the Client instance around**: simply use ``@Client`` (Client class)
116+
instead of the usual ``@app`` (Client instance) namespace and things will work just the same.
116117

117118
The ``main.py`` script is now at its bare minimum and cleanest state.

0 commit comments

Comments
 (0)