@@ -3,9 +3,14 @@ Pyrogram FAQ
33
44This FAQ page provides answers to common questions about Pyrogram and, to some extent, Telegram in general.
55
6+ .. tip ::
7+
8+ If you think something interesting could be added here, feel free to propose it by opening a `Feature Request `_.
9+
610.. contents :: Contents
711 :backlinks: none
812 :local:
13+ :depth: 1
914
1015What is Pyrogram?
1116-----------------
@@ -41,6 +46,7 @@ Why Pyrogram?
4146- **Documented **: Pyrogram API methods, types and public interfaces are well documented.
4247- **Type-hinted **: Exposed Pyrogram types and method parameters are all type-hinted.
4348- **Updated **, to make use of the latest Telegram API version and features.
49+ - **Bot API-like **: Similar to the Bot API in its simplicity, but much more powerful and detailed.
4450- **Pluggable **: The `Smart Plugin `_ system allows to write components with minimal boilerplate code.
4551- **Comprehensive **: Execute any `advanced action `_ an official client is able to do, and even more.
4652
@@ -51,23 +57,41 @@ Why Pyrogram?
5157What can MTProto do more than the Bot API?
5258------------------------------------------
5359
54- - Authorize both user and bot identities.
55- - Upload & download any file, up to 1500 MB each.
56- - Has less overhead due to direct connections to the actual Telegram servers.
57- - Run multiple sessions at once, up to 10 per account (either bot or user).
58- - Get information about any public chat by usernames, even if not a member.
59- - Obtain information about any message existing in a chat using message ids.
60- - retrieve the whole chat members list of either public or private chats.
61- - Receive extra updates, such as the one about a user name change.
62- - More meaningful errors in case something went wrong.
63- - Get API version updates, and thus new features, sooner.
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:
62+
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.
6488
6589Why do I need an API key for bots?
6690----------------------------------
6791
68- Requests against the official bot API endpoint are made via JSON/HTTP, but are handled by a backend application that
69- implements the MTProto protocol -- just like Pyrogram -- and uses its own API key, which is always required, but hidden
70- to the public.
92+ Requests against the official bot API endpoint are made via JSON/HTTP, but are handled by an intermediate server
93+ application that implements the MTProto protocol -- just like Pyrogram -- and uses its own API key, which is always
94+ required, but hidden to the public.
7195
7296.. figure :: https://i.imgur.com/C108qkX.png
7397 :align: center
@@ -76,9 +100,7 @@ Using MTProto is the only way to communicate with the actual Telegram servers, a
76100identify applications by means of a unique key; the bot token identifies a bot as a user and replaces the user's phone
77101number only.
78102
79- Why is the main API (MTProto) superiod
80-
81- I started a client but nothing happens!
103+ I started a client and nothing happens!
82104---------------------------------------
83105
84106If you are connecting from Russia, China or Iran `you need a proxy `_, because Telegram could be partially or
@@ -93,6 +115,15 @@ in a bunch of seconds:
93115 import logging
94116 logging.basicConfig(level = logging.INFO )
95117
118+ Another way to confirm you aren't able to connect to Telegram is by pinging these IP addresses and see whether ping
119+ fails or not:
120+
121+ - DC1: ``149.154.175.50 ``
122+ - DC2: ``149.154.167.51 ``
123+ - DC3: ``149.154.175.100 ``
124+ - DC4: ``149.154.167.91 ``
125+ - DC5: ``91.108.56.149 ``
126+
96127|bug report |
97128
98129.. _you need a proxy : proxy
@@ -114,7 +145,16 @@ things:
114145
115146 **Note:** If you really believe this should not happen, kindly open a `Bug Report`_.
116147
117- .. _Bug Report : https://github.com/pyrogram/pyrogram/issues/new?labels=bug&template=bug_report.md
148+ Can I use the same file_id across different accounts?
149+ -----------------------------------------------------
150+
151+ No, Telegram doesn't allow this.
152+
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 **.
155+
156+ The only exception are stickers' file ids; you can use them across different accounts without any problem, like this
157+ one: ``CAADBAADyg4AAvLQYAEYD4F7vcZ43AI ``.
118158
119159My account has been deactivated/limited!
120160----------------------------------------
@@ -150,4 +190,7 @@ for free under LGPLv3+.
150190
151191In other words: you can use and integrate Pyrogram into your own code --- either open source, under the same or a
152192different licence or even proprietary --- without being required to release the source code of your own applications.
153- However, any modifications to the library itself are required to be published for free under the same LGPLv3+ license.
193+ However, any modifications to the library itself are required to be published for free under the same LGPLv3+ license.
194+
195+ .. _Bug Report : https://github.com/pyrogram/pyrogram/issues/new?labels=bug&template=bug_report.md
196+ .. _Feature Request : https://github.com/pyrogram/pyrogram/issues/new?labels=enhancement&template=feature_request.md
0 commit comments