diff --git a/docs/source/index.rst b/docs/source/index.rst
index 3e0855a5..6210ff05 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -23,13 +23,13 @@ Welcome to Pyrogram
Community
-
+
-
-
@@ -49,14 +49,14 @@ Welcome to Pyrogram
app.run()
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.
+Contents are organized into self-contained topics and can be accessed from the sidebar, or by following them in order
+using the Next button at the end of each page. But first, here's a brief overview of what is this all about.
About
-----
-**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.
+**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.
Features
--------
@@ -64,7 +64,7 @@ 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 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 81 on top of MTProto 2.0.
+- **Updated** to the latest Telegram API version, currently Layer 82 on top of MTProto 2.0.
- **Documented**: The Pyrogram API is well documented and resembles the Telegram Bot API.
- **Full API**, allowing to execute any advanced action an official client is able to do, and more.
diff --git a/docs/source/resources/UpdateHandling.rst b/docs/source/resources/UpdateHandling.rst
index 781a48af..12afe324 100644
--- a/docs/source/resources/UpdateHandling.rst
+++ b/docs/source/resources/UpdateHandling.rst
@@ -2,15 +2,15 @@ Update Handling
===============
Updates are events that happen in your Telegram account (incoming messages, new channel posts, new members join, ...)
-and can be handled by registering one or more callback functions in your app by using an `Handler <../pyrogram/Handlers.html>`_.
+and can be handled by registering one or more callback functions in your app by using `Handlers <../pyrogram/Handlers.html>`_.
To put it simply, whenever an update is received from Telegram it will be dispatched and your previously defined callback
-function(s) will be called back with the update itself as argument.
+function(s) matching it will be called back with the update itself as argument.
Registering an Handler
----------------------
-To explain how `Handlers <../pyrogram/Handlers.html>`_ work let's have a look at the most used one, the
+To explain how handlers work let's have a look at the most used one, the
:obj:`MessageHandler `, which will be in charge for handling :obj:`Message `
updates coming from all around your chats. Every other handler shares the same setup logic; you should not have troubles
settings them up once you learn from this section.
diff --git a/docs/source/start/Installation.rst b/docs/source/start/Installation.rst
index d3ddfe7d..41a7ccac 100644
--- a/docs/source/start/Installation.rst
+++ b/docs/source/start/Installation.rst
@@ -4,11 +4,12 @@ Installation
Being a Python library, Pyrogram requires Python to be installed in your system.
We recommend using the latest version of Python 3 and pip.
-Get Python 3 from https://www.python.org/downloads/ or with your package manager and pip
+Get Python 3 from https://www.python.org/downloads/ (or with your package manager) and pip
by following the instructions at https://pip.pypa.io/en/latest/installing/.
-.. note::
- Pyrogram supports Python 3 only, starting from version 3.4 and PyPy.
+.. important::
+
+ Pyrogram supports **Python 3** only, starting from version 3.4. **PyPy** is supported too.
Install Pyrogram
----------------
@@ -29,7 +30,7 @@ Bleeding Edge
-------------
If you want the latest development version of Pyrogram, you can install it straight from the develop_
-branch using this command:
+branch using this command (you might need to install **git** first):
.. code-block:: bash
diff --git a/docs/source/start/Setup.rst b/docs/source/start/Setup.rst
index e0cccc2c..24caa1f4 100644
--- a/docs/source/start/Setup.rst
+++ b/docs/source/start/Setup.rst
@@ -53,6 +53,7 @@ fits better for you:
)
.. note::
+
The examples below assume you have created a ``config.ini`` file, thus they won't show the *api_id*
and *api_hash* parameters usage.
@@ -74,7 +75,7 @@ the :class:`Client ` class by passing to it a ``session_name``
This starts an interactive shell asking you to input your **phone number** (including your `Country Code`_)
and the **phone code** you will receive:
-.. code::
+.. code-block:: text
Enter phone number: +39**********
Is "+39**********" correct? (y/n): y
@@ -84,7 +85,9 @@ After successfully authorizing yourself, a new file called ``my_account.session`
Pyrogram executing API calls with your identity. This file will be loaded again when you restart your app,
and as long as you keep the session alive, Pyrogram won't ask you again to enter your phone number.
-.. important:: Your ``*.session`` files are personal and must be kept secret.
+.. important::
+
+ Your ``*.session`` files are personal and must be kept secret.
Bot Authorization
-----------------
diff --git a/docs/source/start/Usage.rst b/docs/source/start/Usage.rst
index 6eac5cd1..6c1697b9 100644
--- a/docs/source/start/Usage.rst
+++ b/docs/source/start/Usage.rst
@@ -10,25 +10,38 @@ High-level API
The easiest and recommended way to interact with Telegram is via the high-level Pyrogram methods_ and types_, which are
named after the `Telegram Bot API`_.
-Examples (more on `GitHub `_):
-
-- Get information about the authorized user:
+Here's a simple example:
.. code-block:: python
+ from pyrogram import Client
+
+ app = Client("my_account")
+
+ app.start()
+
print(app.get_me())
+ app.send_message("me", "Hi there! I'm using **Pyrogram**")
+ app.send_location("me", 51.500729, -0.124583)
-- Send a message to yourself (Saved Messages):
+ app.stop()
+
+You can also use Pyrogram in a context manager with the ``with`` statement. The Client will automatically
+:meth:`start ` and :meth:`stop ` gracefully, even in case of unhandled
+exceptions in your code:
.. code-block:: python
- app.send_message("me", "Hi there! I'm using Pyrogram")
+ from pyrogram import Client
-- Upload a new photo (with caption):
+ app = Client("my_account")
- .. code-block:: python
+ with app:
+ print(app.get_me())
+ app.send_message("me", "Hi there! I'm using **Pyrogram**")
+ app.send_location("me", 51.500729, -0.124583)
- app.send_photo("me", "/home/dan/perla.jpg", "Cute!")
+More examples on `GitHub `_.
Raw Functions
-------------
@@ -38,7 +51,9 @@ you have to use the raw :mod:`functions ` and :mod:`type
``pyrogram.api`` package and call any Telegram API method you wish using the :meth:`send() `
method provided by the Client class.
-.. hint:: Every high-level method mentioned in the section above is built on top of these raw functions.
+.. hint::
+
+ Every high-level method mentioned in the section above is built on top of these raw functions.
Nothing stops you from using the raw functions only, but they are rather complex and `plenty of them`_ are already
re-implemented by providing a much simpler and cleaner interface which is very similar to the Bot API.
@@ -54,17 +69,13 @@ Examples (more on `GitHub