Skip to content

Commit 578dab1

Browse files
committed
Docs revamp. Part 6
1 parent 5182204 commit 578dab1

File tree

8 files changed

+174
-49
lines changed

8 files changed

+174
-49
lines changed
File renamed without changes.
Lines changed: 32 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ C. It enables you to easily create custom applications for both user and bot ide
2020
`MTProto API`_ with the Python programming language.
2121

2222
.. _Telegram: https://telegram.org
23-
.. _MTProto API: https://core.telegram.org/api#telegram-api
23+
.. _MTProto API: ../topics/mtproto-vs-botapi#what-is-the-mtproto-api
2424

25-
What does the name mean?
26-
------------------------
25+
Where does the name come from?
26+
------------------------------
2727

28-
The word "Pyrogram" is composed by **pyro**, which comes from the Greek word *πῦρ (pyr)*, meaning fire, and **gram**,
28+
The name "Pyrogram" is composed by **pyro**, which comes from the Greek word *πῦρ (pyr)*, meaning fire, and **gram**,
2929
from *Telegram*. The word *pyro* itself is built from *Python*, **py** for short, and the suffix **ro** to come up with
3030
the word *fire*, which also inspired the project logo.
3131

32-
How old is the project?
33-
-----------------------
32+
How old is Pyrogram?
33+
--------------------
3434

3535
Pyrogram was first released on December 12, 2017. The actual work on the framework began roughly three months prior the
3636
initial public release on `GitHub`_.
@@ -51,40 +51,15 @@ Why Pyrogram?
5151
- **Comprehensive**: Execute any `advanced action`_ an official client is able to do, and even more.
5252

5353
.. _TgCrypto: https://github.com/pyrogram/tgcrypto
54-
.. _Smart Plugin: smart-plugins
55-
.. _advanced action: advanced-usage
54+
.. _Smart Plugin: ../topics/smart-plugins
55+
.. _advanced action: ../topics/advanced-usage
5656

5757
What can MTProto do more than the Bot API?
5858
------------------------------------------
5959

60-
Here you can find a list of all the known advantages in using MTProto-based libraries (Pyrogram) instead of the official
61-
HTTP Bot API:
60+
For a detailed answer, please refer to the `MTProto vs. Bot API`_ page.
6261

63-
- **Authorize both user and bot identities**: The Bot API only allows bot accounts.
64-
65-
- **Upload & download any file, up to 1500 MB each (~1.5 GB)**: The Bot API allows uploads and downloads of files only
66-
up to 50 MB / 20 MB in size (respectively).
67-
68-
- **Has less overhead due to direct connections to Telegram**: The Bot API uses an intermediate server to handle HTTP
69-
requests before they are sent to the actual Telegram servers.
70-
71-
- **Run multiple sessions at once, up to 10 per account (either bot or user)**: The Bot API intermediate server will
72-
terminate any other session in case you try to use the same bot again in a parallel connection.
73-
74-
- **Get information about any public chat by usernames, even if not a member**: The Bot API simply doesn't support this.
75-
76-
- **Obtain information about any message existing in a chat using their ids**: The Bot API simply doesn't support this.
77-
78-
- **Retrieve the whole chat members list of either public or private chats**: The Bot API simply doesn't support this.
79-
80-
- **Receive extra updates, such as the one about a user name change**: The Bot API simply doesn't support this.
81-
82-
- **Has more meaningful errors in case something went wrong**: The Bot API reports less detailed errors.
83-
84-
- **Has much more detailed types and powerful methods**: The Bot API types often miss some useful information about
85-
Telegram's type and some of the methods are limited as well.
86-
87-
- **Get API version updates, and thus new features, sooner**: The Bot API is simply slower in implementing new features.
62+
.. _MTProto vs. Bot API: ../topics/mtproto-vs-botapi
8863

8964
Why do I need an API key for bots?
9065
----------------------------------
@@ -126,7 +101,7 @@ fails or not:
126101

127102
|bug report|
128103

129-
.. _you need a proxy: proxy
104+
.. _you need a proxy: ../topics/proxy
130105

131106
I keep getting PEER_ID_INVALID error!
132107
-------------------------------------------
@@ -150,12 +125,27 @@ Can I use the same file_id across different accounts?
150125

151126
No, Telegram doesn't allow this.
152127

153-
File ids are bound to a specific user/bot, and an attempt in using a foreign file id will result in errors such as
154-
**[400 MEDIA_EMPTY]: The media is invalid**.
128+
File ids are personal and bound to a specific user/bot -- and an attempt in using a foreign file id will result in
129+
errors such as **[400 MEDIA_EMPTY]: The media is invalid**.
155130

156131
The only exception are stickers' file ids; you can use them across different accounts without any problem, like this
157132
one: ``CAADBAADyg4AAvLQYAEYD4F7vcZ43AI``.
158133

134+
Can I use Bot API's file_ids in Pyrogram?
135+
-----------------------------------------
136+
137+
Definitely! All file ids you might have taken from the Bot API are 100% compatible and re-usable in Pyrogram...
138+
139+
...at least for now.
140+
141+
Telegram is slowly changing some server's internals and it's doing it in such a way that file ids are going to break
142+
inevitably. Not only this, but it seems that the new, hypothetical, file ids could also possibly expire at anytime, thus
143+
losing the *persistence* feature.
144+
145+
This change will most likely affect the official `Bot API <../topics/mtproto-vs-botapi#what-is-the-bot-api>`_ too
146+
(unless Telegram implements some workarounds server-side to keep backwards compatibility, which Pyrogram could in turn
147+
make use of) and we can expect a proper notice from Telegram.
148+
159149
My account has been deactivated/limited!
160150
----------------------------------------
161151

@@ -184,13 +174,14 @@ About the License
184174
.. image:: https://www.gnu.org/graphics/lgplv3-with-text-154x68.png
185175
:align: left
186176

187-
Pyrogram is free software and is currently licensed under the terms of the GNU Lesser General Public License v3 or later
188-
(LGPLv3+). In short: you may use, redistribute and/or modify it provided that modifications are described and licensed
189-
for free under LGPLv3+.
177+
Pyrogram is free software and is currently licensed under the terms of the
178+
`GNU Lesser General Public License v3 or later (LGPLv3+)`_. In short: you may use, redistribute and/or modify it
179+
provided that modifications are described and licensed for free under LGPLv3+.
190180

191181
In other words: you can use and integrate Pyrogram into your own code --- either open source, under the same or a
192182
different licence or even proprietary --- without being required to release the source code of your own applications.
193183
However, any modifications to the library itself are required to be published for free under the same LGPLv3+ license.
194184

185+
.. _GNU Lesser General Public License v3 or later (LGPLv3+): https://github.com/pyrogram/pyrogram/blob/develop/COPYING.lesser
195186
.. _Bug Report: https://github.com/pyrogram/pyrogram/issues/new?labels=bug&template=bug_report.md
196187
.. _Feature Request: https://github.com/pyrogram/pyrogram/issues/new?labels=enhancement&template=feature_request.md
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Pyrogram Glossary
2-
-----------------
2+
=================
33

44
This page contains a list of common words with brief explanations related to Pyrogram and, to some extent, Telegram in
55
general. Some words may as well link to dedicated articles in case the topic is covered in a more detailed fashion.
@@ -18,6 +18,7 @@ general. Some words may as well link to dedicated articles in case the topic is
1818
API key
1919
A secret code used to authenticate and/or authorize a specific application to Telegram in order for it to
2020
control how the API is being used, for example, to prevent abuses of the API.
21+
`More on API keys <../intro/setup#api-keys>`_.
2122

2223
DC
2324
Also known as *data center*, is a place where lots of computer systems are housed and used together in order to
@@ -29,18 +30,21 @@ general. Some words may as well link to dedicated articles in case the topic is
2930

3031
RPCError
3132
An error caused by an RPC which must be returned in place of the successful result in order to let the caller
32-
know something went wrong.
33+
know something went wrong. `More on RPCError <../start/errors>`_.
3334

3435
MTProto
35-
The name of the custom-made, open encryption protocol by Telegram, implemented in Pyrogram.
36+
The name of the custom-made, open and encrypted protocol by Telegram, implemented in Pyrogram.
37+
`More on MTProto <mtproto-vs-botapi>`_.
3638

3739
MTProto API
3840
The Telegram main API Pyrogram makes use of, which is able to connect both users and normal bots to Telegram
39-
using MTProto as application layer protocol and execute any method Telegram provides from its public schema.
41+
using MTProto as application layer protocol and execute any method Telegram provides from its public TL-schema.
42+
`More on MTProto API <mtproto-vs-botapi#what-is-the-mtproto-api>`_.
4043

4144
Bot API
42-
The `Telegram Bot API`_ that is able to only connect normal bots to Telegram using HTTP as application layer
45+
The Telegram Bot API that is able to only connect normal bots to Telegram using HTTP as application layer
4346
protocol and allows to execute a subset of the main Telegram API.
47+
`More on Bot API <mtproto-vs-botapi#what-is-the-bot-api>`_.
4448

4549
Pyrogrammer
4650
A developer that uses Pyrogram to build Telegram applications.
@@ -61,12 +65,13 @@ general. Some words may as well link to dedicated articles in case the topic is
6165
Handler
6266
An object that wraps around a callback function that is *actually meant* to be registered into the framework,
6367
which will then be able to handle a specific kind of events, such as a new incoming message, for example.
68+
`More on Handlers <../start/updates>`_
6469

6570
Decorator
6671
Also known as *function decorator*, in Python, is a callable object that is used to modify another function.
67-
Decorators in Pyrogram are used to automatically register callback functions for `handling updates`_.
72+
Decorators in Pyrogram are used to automatically register callback functions for handling updates.
73+
`More on Decorators <../start/updates#using-decorators>`_
6874

69-
.. _Telegram Bot API: https://core.telegram.org/bots/api
7075
.. _handling updates: ../start/updates
7176

7277
.. _Feature Request: https://github.com/pyrogram/pyrogram/issues/new?labels=enhancement&template=feature_request.md

docs/source/meta/powered-by.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
Powered by Pyrogram
2+
===================
3+
4+
This is a collection of remarkable projects made with Pyrogram.
5+
6+
.. A collection of Pyrojects :^)
7+
8+
.. tip::
9+
10+
If you'd like to propose a project that's worth being listed here, feel free to open a `Feature Request`_.
11+
12+
Projects Showcase
13+
-----------------
14+
15+
`YTAudioBot <https://t.me/ytaudio>`_
16+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17+
18+
| **A YouTube audio downloader on Telegram, serving over 200k MAU.**
19+
| --- by `Dan <https://t.me/haskell>`_
20+
21+
- Main: https://t.me/ytaudiobot
22+
- Mirror: https://t.me/ytaudio_bot
23+
- Website: https://ytaudiobot.ml
24+
25+
-----
26+
27+
`Pyrogram Assistant <https://github.com/pyrogram/assistant>`_
28+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29+
30+
| **The assistant bot that helps people with Pyrogram directly on Telegram**
31+
| --- by `Dan <https://t.me/haskell>`_
32+
33+
- Bot: https://t.me/pyrogrambot
34+
- Source Code: https://github.com/pyrogram/assistant
35+
36+
-----
37+
38+
`PyroBot <https://git.colinshark.de/PyroBot/PyroBot>`_
39+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40+
41+
| **A Telegram userbot based on Pyrogram**
42+
| --- by `Colin <https://t.me/ColinShark>`_
43+
44+
- Source Code: https://git.colinshark.de/PyroBot/PyroBot
45+
46+
-----
47+
48+
`TgIntegration <https://github.com/JosXa/tgintegration>`_
49+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50+
51+
| **Integration Test Library for Telegram Messenger Bots in Python**
52+
| --- by `JosXa <https://t.me/JosXa>`_
53+
54+
- Source Code: https://github.com/JosXa/tgintegration
55+
56+
-----
57+
58+
`BotListBot <https://t.me/botlistt>`_
59+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
| **A bot which partly uses Pyrogram to check if other bots are still alive**
62+
| --- by `JosXa <https://t.me/JosXa>`_
63+
64+
- Source Code: https://github.com/JosXa/BotListBot
65+
66+
-----
67+
68+
.. _Feature Request: https://github.com/pyrogram/pyrogram/issues/new?labels=enhancement&template=feature_request.md
69+
File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Support Pyrogram Development
2+
============================
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ after the session name, which will be ``my_bot.session`` for the example below.
6464
6565
app.run()
6666
67-
.. _project is set up: setup.html
67+
.. _project is set up: ../intro/setup
6868
.. _Country Code: https://en.wikipedia.org/wiki/List_of_country_calling_codes
6969
.. _Bot Father: https://t.me/botfather
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
MTProto vs. Bot API
2+
===================
3+
4+
Being Pyrogram an MTProto-based library, this very feature makes it already superior to, what is usually called, the
5+
official Bot API.
6+
7+
What is the MTProto API?
8+
------------------------
9+
10+
MTProto, took alone, is the name of the custom-made, open and encrypted communication protocol created by Telegram
11+
itself --- it's the only protocol used to exchange information between a client application and the actual Telegram
12+
servers.
13+
14+
The MTProto **API** however, is what people, for convenience, call the main Telegram API as a whole. This API is able
15+
to authorize both users and bots and happens to be built on top of the MTProto encryption protocol by means of binary
16+
data serialized in a specific way, as described by the TL language, hence the correlation.
17+
18+
What is the Bot API?
19+
--------------------
20+
21+
The Bot API is an HTTP(S) interface for building normal bots. Bots are special accounts that are authorized via tokens
22+
instead of phone numbers. The Bot API is built yet again on top of the main Telegram API, but runs on an intermediate
23+
server application that in turn communicates with the actual Telegram servers using MTProto.
24+
25+
.. figure:: https://i.imgur.com/C108qkX.png
26+
:align: center
27+
28+
Advantages of the MTProto API
29+
-----------------------------
30+
31+
Here is a list of all the known advantages in using MTProto-based libraries (such as Pyrogram) instead of the official
32+
HTTP Bot API. Using Pyrogram you can:
33+
34+
- **Authorize both user and bot identities**: The Bot API only allows bot accounts.
35+
36+
- **Upload & download any file, up to 1500 MB each (~1.5 GB)**: The Bot API allows uploads and downloads of files only
37+
up to 50 MB / 20 MB in size (respectively).
38+
39+
- **Has less overhead due to direct connections to Telegram**: The Bot API uses an intermediate server to handle HTTP
40+
requests before they are sent to the actual Telegram servers.
41+
42+
- **Run multiple sessions at once, up to 10 per account (either bot or user)**: The Bot API intermediate server will
43+
terminate any other session in case you try to use the same bot again in a parallel connection.
44+
45+
- **Get information about any public chat by usernames, even if not a member**: The Bot API simply doesn't support this.
46+
47+
- **Obtain information about any message existing in a chat using their ids**: The Bot API simply doesn't support this.
48+
49+
- **Retrieve the whole chat members list of either public or private chats**: The Bot API simply doesn't support this.
50+
51+
- **Receive extra updates, such as the one about a user name change**: The Bot API simply doesn't support this.
52+
53+
- **Has more meaningful errors in case something went wrong**: The Bot API reports less detailed errors.
54+
55+
- **Has much more detailed types and powerful methods**: The Bot API types often miss some useful information about
56+
Telegram's type and some of the methods are limited as well.
57+
58+
- **Get API version updates, and thus new features, sooner**: The Bot API is simply slower in implementing new features.

0 commit comments

Comments
 (0)