Skip to content

Commit a0e0cbe

Browse files
committed
Improve FAQs
1 parent a4566de commit a0e0cbe

File tree

1 file changed

+7
-41
lines changed

1 file changed

+7
-41
lines changed

docs/source/faq.rst

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,17 @@ Can I use the same file_id across different accounts?
111111

112112
No, Telegram doesn't allow this.
113113

114-
File ids are personal and bound to a specific user/bot -- and an attempt in using a foreign file id will result in
115-
errors such as ``[400 MEDIA_EMPTY]``.
114+
File ids are personal and bound to a specific account; an attempt in using a foreign file id will result in errors such
115+
as ``[400 MEDIA_EMPTY]``.
116116

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

120120
Can I use Bot API's file_id values in Pyrogram?
121121
-----------------------------------------------
122122

123-
Definitely! All file ids you might have taken from the Bot API are 100% compatible and re-usable in Pyrogram.
124-
125-
**However...**
126-
127-
Telegram is slowly changing some server's internals and it's doing it in such a way that file ids are going to break
128-
inevitably. Not only this, but it seems that the new, hypothetical, file ids could also possibly expire at anytime, thus
129-
losing the *persistence* feature (see `What is a file_ref and why do I need it?`_).
130-
131-
This change will most likely affect the official :doc:`Bot API <topics/mtproto-vs-botapi>` too (unless Telegram
132-
implements some workarounds server-side to keep backwards compatibility, which Pyrogram could in turn make use of) and
133-
we can expect a proper notice from Telegram.
123+
Yes! All file ids you take or might have taken from the Bot API are 100% compatible and re-usable in Pyrogram.
124+
The opposite is also valid, you can take any file id generated by Pyrogram and re-use in the Bot API.
134125

135126
Can I use multiple clients at once on the same account?
136127
-------------------------------------------------------
@@ -259,37 +250,12 @@ The error in question is ``[400 PEER_ID_INVALID]``, and could mean several thing
259250
- The chat id you tried to use is simply wrong, double check it.
260251
- The chat id refers to a group or channel you are not a member of.
261252
- The chat id argument you passed is in form of a string; you have to convert it into an integer with ``int(chat_id)``.
262-
- The chat id refers to a user your current session haven't met yet.
253+
- The chat id refers to a user or chat your current session hasn't met yet.
263254

264255
About the last point: in order for you to meet a user and thus communicate with them, you should ask yourself how to
265256
contact people using official apps. The answer is the same for Pyrogram too and involves normal usages such as searching
266-
for usernames, meeting them in a common group, have their phone contacts saved or getting a message mentioning them,
267-
either a forward or a mention in the message text.
268-
269-
What is a file_ref and why do I need it?
270-
----------------------------------------
271-
272-
.. note::
273-
274-
This FAQ is currently applicable to user accounts only. Bot accounts are still doing fine without a file_ref
275-
(even though this can change anytime since it's a Telegram's internal server behaviour).
276-
277-
Similarly to what happens with users and chats which need to first be encountered in order to interact with them, media
278-
messages also need to be "seen" recently before downloading or re-sending without uploading as new file.
279-
280-
**What is it meant by "they need to be seen recently"?**
281-
282-
That means you have to fetch the original media messages prior any action in order to get a valid and up to date value
283-
called file reference (file_ref) which, in pair with a file_id, enables you to interact with the media. This file_ref
284-
value won't last forever (usually 24h, but could expire anytime) and in case of errors you have to get a refreshed
285-
file_ref by re-fetching the original message (fetching forwarded media messages does also work).
286-
287-
**Ok, but what is a file_ref actually needed for?**
288-
289-
Nobody knows for sure, but is likely because that's the correct approach for handling tons of files uploaded by users in
290-
Telegram's cloud. Which means, as soon as the media message still exists, a valid file_ref can be obtained, otherwise,
291-
in case there's no more messages referencing a specific media, Telegram is able to free disk space by deleting old
292-
files.
257+
for usernames, meeting them in a common group, having their phone contacts saved, getting a message mentioning them
258+
(either a forward or a mention in the message text) or obtaining the dialogs list.
293259

294260
Code hangs when I stop, restart, add/remove_handler
295261
---------------------------------------------------

0 commit comments

Comments
 (0)