From 0c14a0aa3c511abcb445a1953c06d2a9c52ec041 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 25 Jun 2018 18:06:00 +0200 Subject: [PATCH] Add CustomizeSessions page --- docs/source/index.rst | 1 + docs/source/resources/CustomizeSessions.rst | 68 +++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 docs/source/resources/CustomizeSessions.rst diff --git a/docs/source/index.rst b/docs/source/index.rst index c52e239b..cffa851d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -89,6 +89,7 @@ To get started, press the Next button. resources/AutoAuthorization resources/TextFormatting resources/BotsInteraction + resources/CustomizeSessions resources/ErrorHandling .. toctree:: diff --git a/docs/source/resources/CustomizeSessions.rst b/docs/source/resources/CustomizeSessions.rst new file mode 100644 index 00000000..4564eaf0 --- /dev/null +++ b/docs/source/resources/CustomizeSessions.rst @@ -0,0 +1,68 @@ +Customize Sessions +================== + +As you may probably know, Telegram allows Users (and Bots) having more than one session (authorizations) registered +in the system at the same time. + +Briefly explaining, sessions are simply new logins in your account and can be reviewed in the settings of an official +app or by invoking `GetAuthorizations <../functions/account/GetAuthorizations>`_ with Pyrogram. + + +.. figure:: https://i.imgur.com/lzGPCdZ.png + :width: 70% + :align: center + + A Pyrogram session running on Linux, Python 3.6. + +That's how a session looks like on the Android app, showing the three main pieces of information. + +- ``app_version``: **Pyrogram 🔥 0.7.5** +- ``device_model``: **CPython 3.6.5** +- ``system_version``: **Linux 4.15.0-23-generic** + +Set Custom Values +----------------- + +To set custom values, you can either make use of the ``config.ini`` file, this way: + +.. code-block:: ini + + [pyrogram] + app_version = 1.2.3 + device_model = PC + system_version = Linux + +Or, pass the arguments directly in the Client's constructor. + +.. code-block:: python + + app = Client( + "my_account", + app_version="1.2.3", + device_model="PC", + system_version="Linux" + ) + +Set Custom Languages +-------------------- + +These are two extra parameters you can change: ``system_lang_code`` (OS language) and ``lang_code`` (Client language). +They exist to tell Telegram in which language it should speak to you (terms of service, service messages, ...) and are +usually both set to the same value, in `ISO 639-1 `_ standard. +Pyrogram uses "en" (English) for both by default. + +With the following code we make Telegram know we want it to speak in Italian (it): + +.. code-block:: ini + + [pyrogram] + system_lang_code = it + lang_code = it + +.. code-block:: python + + app = Client( + "my_account", + system_lang_code="it", + lang_code="it", + ) \ No newline at end of file