diff --git a/docs/source/conf.py b/docs/source/conf.py index cf8ef732..cecf047f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ import sys sys.path.insert(0, os.path.abspath('../..')) # Import after sys.path.insert() to avoid issues -# from pyrogram import __version__ +from pyrogram import __version__ # -- General configuration ------------------------------------------------ @@ -68,9 +68,9 @@ author = 'Dan Tรจs' # built documents. # # The short X.Y version. -# version = "version " + __version__ +version = "version " + __version__ # The full version, including alpha/beta/rc tags. -# release = version +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -111,7 +111,7 @@ html_theme_options = { 'collapse_navigation': False, 'sticky_navigation': False, 'logo_only': True, - 'display_version': False + 'display_version': True } # The name of an image file (relative to this directory) to place at the top diff --git a/docs/source/index.rst b/docs/source/index.rst index 80faf684..fced42bb 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -53,23 +53,23 @@ Welcome to Pyrogram Welcome to Pyrogram's Documentation! Here you can find resources for learning how to use the library. Contents are organized by topic and can be accessed from the sidebar, or by following them one by one using the Next -button at the end of each page. But first, here's a brief overview of what is this all about: +button at the end of each page. But first, here's a brief overview of what is this all about. -Overview --------- +About +----- -**Pyrogram** is a brand new Telegram_ Client Library written from the ground up in Python and C. It can be used for building +Pyrogram is a brand new Telegram_ Client Library written from the ground up in Python and C. It can be used for building custom Telegram applications that interact with the MTProto API as both User and Bot. -Awesomeness ------------ +Features +-------- -- ๐Ÿ“ฆ **Easy to use**: You can easily install Pyrogram using pip and start building your app right away. -- ๐Ÿš€ **High-level**: The low-level details of MTProto are automatically handled by the library. -- โšก๏ธ **Fast**: Crypto parts are boosted up by TgCrypto_, a high-performance library written in pure C. -- ๐Ÿ”„ **Updated** to the latest Telegram MTProto API version, currently Layer 76. -- ๐Ÿ“– **Documented**: Pyrogram API methods are documented and resemble the Telegram Bot API. -- ๐Ÿ”‹ **Full API**, allows to execute any advanced action an official client is able to do, and more. +- **Easy to use**: You can easily install Pyrogram using pip and start building your app right away. +- **High-level**: The low-level details of MTProto are abstracted and automatically handled. +- **Fast**: Crypto parts are boosted up by TgCrypto_, a high-performance library written in pure C. +- **Updated** to the latest Telegram API version, currently Layer 76 running on MTProto 2.0. +- **Documented**: Pyrogram API methods are documented and resemble the Telegram Bot API. +- **Full API**, allowing to execute any advanced action an official client is able to do, and more. To get started, press the Next button. @@ -85,13 +85,13 @@ To get started, press the Next button. :hidden: :caption: Resources - resources/TextFormatting resources/UpdateHandling - resources/ErrorHandling resources/SOCKS5Proxy - resources/AutoAuthorization resources/TgCrypto + resources/AutoAuthorization + resources/TextFormatting resources/BotsInteraction + resources/ErrorHandling .. toctree:: :hidden: diff --git a/docs/source/resources/UpdateHandling.rst b/docs/source/resources/UpdateHandling.rst index e2484af9..a6c73187 100644 --- a/docs/source/resources/UpdateHandling.rst +++ b/docs/source/resources/UpdateHandling.rst @@ -11,73 +11,74 @@ Registering an Handler We shall examine the :obj:`MessageHandler `, which will be in charge for handling :obj:`Message ` objects. -The easiest and nicest way to register a MessageHandler is by decorating your function with the -:meth:`on_message() ` decorator. Here's a full example that prints out the content -of a message as soon as it arrives. +- The easiest and nicest way to register a MessageHandler is by decorating your function with the + :meth:`on_message() ` decorator. Here's a full example that prints out the content + of a message as soon as it arrives. -.. code-block:: python + .. code-block:: python - from pyrogram import Client + from pyrogram import Client - app = Client("my_account") + app = Client("my_account") - @app.on_message() - def my_handler(client, message): - print(message) + @app.on_message() + def my_handler(client, message): + print(message) - app.start() - app.idle() + app.start() + app.idle() -If you prefer not to use decorators, there is an alternative way for registering Handlers. -This is useful, for example, if you want to keep your callback functions in a separate file. +- If you prefer not to use decorators, there is an alternative way for registering Handlers. + This is useful, for example, when you want to keep your callback functions in a separate file. -.. code-block:: python + .. code-block:: python - from pyrogram import Client, MessageHandler + from pyrogram import Client, MessageHandler - def my_handler(client, message): - print(message) + def my_handler(client, message): + print(message) - app = Client("my_account") + app = Client("my_account") - app.add_handler(MessageHandler(my_handler)) - - app.start() - app.idle() + app.add_handler(MessageHandler(my_handler)) + app.start() + app.idle() Using Filters ------------- For a finer grained control over what kind of messages will be allowed or not in your callback functions, you can use -:class:`Filters `. The next example will show you how to handle only messages -containing an :obj:`Audio ` object: +:class:`Filters `. -.. code-block:: python +- This example will show you how to handle only messages containing an :obj:`Audio ` + object: - from pyrogram import Filters + .. code-block:: python + + from pyrogram import Filters - @app.on_message(Filters.audio) - def my_handler(client, message): - print(message) + @app.on_message(Filters.audio) + def my_handler(client, message): + print(message) -or, without decorators: +- or, without decorators: -.. code-block:: python + .. code-block:: python - from pyrogram import Filters, Messagehandler + from pyrogram import Filters, Messagehandler - def my_handler(client, message): - print(message) + def my_handler(client, message): + print(message) - app.add_handler(MessageHandler(my_handler, Filters.audio)) + app.add_handler(MessageHandler(my_handler, Filters.audio)) Combining Filters ----------------- @@ -142,5 +143,5 @@ More handlers using different filters can also live together: @app.on_message(Filters.chat("PyrogramChat")) - def my_handler(client, message): + def from_pyrogramchat(client, message): print("New message in @PyrogramChat") diff --git a/docs/source/start/BasicUsage.rst b/docs/source/start/BasicUsage.rst index 2f376675..94dfd00c 100644 --- a/docs/source/start/BasicUsage.rst +++ b/docs/source/start/BasicUsage.rst @@ -10,7 +10,7 @@ Simple API Access ----------------- The easiest way to interact with the Telegram API is via the :class:`Client ` class, which -exposes bot-like_ methods: +exposes `Bot API-like`_ methods: - Get information about the authorized user: @@ -94,4 +94,4 @@ Here some examples: ) ) -.. _bot-like: https://core.telegram.org/bots/api#available-methods \ No newline at end of file +.. _`Bot API-like`: https://core.telegram.org/bots/api#available-methods \ No newline at end of file diff --git a/docs/source/start/ProjectSetup.rst b/docs/source/start/ProjectSetup.rst index 3ac16336..4e397413 100644 --- a/docs/source/start/ProjectSetup.rst +++ b/docs/source/start/ProjectSetup.rst @@ -12,7 +12,7 @@ If you already have one you can skip this step, otherwise: #. Visit https://my.telegram.org/apps and log in with your Telegram Account. #. Fill out the form to register a new Telegram application. -#. Done. The Telegram API key consists of two parts: the **App api_id** and the **App api_hash** +#. Done. The Telegram API key consists of two parts: the **App api_id** and the **App api_hash**. .. important:: This key should be kept secret. diff --git a/docs/source/start/QuickInstallation.rst b/docs/source/start/QuickInstallation.rst index 8203550e..7044bfee 100644 --- a/docs/source/start/QuickInstallation.rst +++ b/docs/source/start/QuickInstallation.rst @@ -1,17 +1,17 @@ Quick Installation ================== -The easiest way to install and upgrade Pyrogram is by using **pip**: +- The easiest way to install and upgrade Pyrogram is by using **pip**: -.. code-block:: bash + .. code-block:: bash - $ pip3 install --upgrade pyrogram + $ pip3 install --upgrade pyrogram -or, with TgCrypto_ (recommended): +- or, with TgCrypto_ (recommended): -.. code-block:: bash + .. code-block:: bash - $ pip3 install --upgrade pyrogram[tgcrypto] + $ pip3 install --upgrade pyrogram[tgcrypto] Bleeding Edge ------------- @@ -32,6 +32,6 @@ If no error shows up you are good to go. >>> import pyrogram >>> pyrogram.__version__ - '0.6.5' + '0.7.0' .. _TgCrypto: https://docs.pyrogram.ml/resources/TgCrypto \ No newline at end of file