Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit fc79c2a

Browse files
Update Pyrogram to v2.0.27
1 parent a37f0d7 commit fc79c2a

31 files changed

Lines changed: 208 additions & 142 deletions

compiler/api/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def start(format: bool = False):
378378
else:
379379
docstring += f"Telegram API method.\n\n"
380380

381-
docstring += f" Details:\n - Layer: ``{layer}``\n - ID: ``{c.id}``\n\n"
381+
docstring += f" Details:\n - Layer: ``{layer}``\n - ID: ``{c.id[2:].upper()}``\n\n"
382382

383383
if docstring_args:
384384
docstring += " Parameters:\n " + "\n ".join(docstring_args)

compiler/api/source/main_api.tl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ userStatusLastMonth#77ebc742 = UserStatus;
103103
chatEmpty#29562865 id:long = Chat;
104104
chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
105105
chatForbidden#6592a1a7 id:long title:string = Chat;
106-
channel#8261ac61 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
106+
channel#8261ac61 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
107107
channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat;
108108

109109
chatFull#d18ee226 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?Vector<string> = ChatFull;
@@ -392,9 +392,9 @@ photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
392392
upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
393393
upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;
394394

395-
dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
395+
dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
396396

397-
config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
397+
config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
398398

399399
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
400400

@@ -852,7 +852,7 @@ phoneCallAccepted#3660c311 flags:# video:flags.6?true id:long access_hash:long d
852852
phoneCall#967f7c67 flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int = PhoneCall;
853853
phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;
854854

855-
phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
855+
phoneConnection#9cc123c7 flags:# tcp:flags.0?true id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
856856
phoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection;
857857

858858
phoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector<string> = PhoneCallProtocol;
@@ -1205,7 +1205,7 @@ messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> use
12051205

12061206
messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
12071207

1208-
messageReplyHeader#a6d57763 flags:# reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;
1208+
messageReplyHeader#a6d57763 flags:# reply_to_scheduled:flags.2?true reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;
12091209

12101210
messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
12111211

@@ -1273,7 +1273,7 @@ account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordR
12731273
account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult;
12741274
account.resetPasswordOk#e926d63e = account.ResetPasswordResult;
12751275

1276-
sponsoredMessage#3a836df8 flags:# random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string message:string entities:flags.1?Vector<MessageEntity> = SponsoredMessage;
1276+
sponsoredMessage#3a836df8 flags:# recommended:flags.5?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string message:string entities:flags.1?Vector<MessageEntity> = SponsoredMessage;
12771277

12781278
messages.sponsoredMessages#65a4c7d5 messages:Vector<SponsoredMessage> chats:Vector<Chat> users:Vector<User> = messages.SponsoredMessages;
12791279

@@ -1785,6 +1785,7 @@ phone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = U
17851785
phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates;
17861786
phone.getGroupCallStreamChannels#1ab21940 call:InputGroupCall = phone.GroupCallStreamChannels;
17871787
phone.getGroupCallStreamRtmpUrl#deb3abbf peer:InputPeer revoke:Bool = phone.GroupCallStreamRtmpUrl;
1788+
phone.saveCallLog#41248786 peer:InputPhoneCall file:InputFile = Bool;
17881789

17891790
langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
17901791
langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
@@ -1801,4 +1802,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel
18011802
stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
18021803
stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
18031804

1804-
// LAYER 140
1805+
// LAYER 142

compiler/docs/compiler.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,19 @@ def build(path, level=0):
6565
if level:
6666
full_path = base + "/" + full_path
6767

68+
namespace = path.split("/")[-1]
69+
if namespace in ["base", "types", "functions"]:
70+
namespace = ""
71+
72+
full_name = f"{(namespace + '.') if namespace else ''}{name}"
73+
6874
os.makedirs(os.path.dirname(DESTINATION + "/" + full_path), exist_ok=True)
6975

7076
with open(DESTINATION + "/" + full_path, "w", encoding="utf-8") as f:
7177
f.write(
7278
page_template.format(
73-
title=name,
74-
title_markup="=" * len(name),
79+
title=full_name,
80+
title_markup="=" * len(full_name),
7581
full_class_path="pyrogram.raw.{}".format(
7682
".".join(full_path.split("/")[:-1]) + "." + name
7783
)
@@ -90,7 +96,7 @@ def build(path, level=0):
9096
entities = []
9197

9298
for i in v:
93-
entities.append(snek(i).replace("_", "-"))
99+
entities.append(f'{i} <{snek(i).replace("_", "-")}>')
94100

95101
if k != base:
96102
inner_path = base + "/" + k + "/index" + ".rst"

compiler/errors/source/400_BAD_REQUEST.tsv

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ACCESS_TOKEN_EXPIRED The bot token has expired
44
ACCESS_TOKEN_INVALID The bot access token is invalid
55
ADMINS_TOO_MUCH The chat has too many administrators
66
ADMIN_RANK_EMOJI_NOT_ALLOWED Emoji are not allowed in custom administrator titles
7-
ADMIN_RANK_INVALID The custom administrator title is invalid or is longer than 16 characters
7+
ADMIN_RANK_INVALID The custom administrator title is invalid or too long
88
ALBUM_PHOTOS_TOO_MANY Too many photos were included in the album
99
API_ID_INVALID The api_id/api_hash combination is invalid
1010
API_ID_PUBLISHED_FLOOD You are using an API key that is limited on the server side because it was published somewhere
@@ -35,7 +35,7 @@ BOT_SCORE_NOT_MODIFIED The bot score was not modified
3535
BROADCAST_ID_INVALID The channel is invalid
3636
BROADCAST_PUBLIC_VOTERS_FORBIDDEN Polls with public voters cannot be sent in channels
3737
BROADCAST_REQUIRED The request can only be used with a channel
38-
BUTTON_DATA_INVALID The button callback data contains invalid data or exceeds 64 bytes
38+
BUTTON_DATA_INVALID The button callback data is invalid or too large
3939
BUTTON_TYPE_INVALID The type of one of the buttons you provided is invalid
4040
BUTTON_URL_INVALID The button url is invalid
4141
CALL_ALREADY_ACCEPTED The call is already accepted
@@ -49,7 +49,7 @@ CHANNEL_ADD_INVALID Internal error.
4949
CHANNEL_BANNED The channel is banned
5050
CHANNEL_INVALID The channel parameter is invalid
5151
CHANNEL_PRIVATE The channel/supergroup is not accessible
52-
CHANNEL_TOO_LARGE The channel is too large to be deleted; this error is issued when trying to delete channels with more than 1000 members (subject to change)
52+
CHANNEL_TOO_LARGE The channel is too large
5353
CHAT_ABOUT_NOT_MODIFIED The chat about text was not modified because you tried to edit it using the same content
5454
CHAT_ABOUT_TOO_LONG The chat about text is too long
5555
CHAT_ADMIN_REQUIRED The method requires chat admin privileges
@@ -109,13 +109,13 @@ FIELD_NAME_EMPTY The field with the name FIELD_NAME is missing
109109
FIELD_NAME_INVALID The field with the name FIELD_NAME is invalid
110110
FILE_ID_INVALID The file id is invalid
111111
FILE_MIGRATE_X The file is in Data Center No. {value}
112-
FILE_PARTS_INVALID Invalid number of parts. The value is not between 1 and 4000
112+
FILE_PARTS_INVALID Invalid number of parts.
113113
FILE_PART_EMPTY The file part sent is empty
114-
FILE_PART_INVALID The file part number is invalid. The value is not between 0 and 3999
114+
FILE_PART_INVALID The file part number is invalid.
115115
FILE_PART_LENGTH_INVALID The length of a file part is invalid
116116
FILE_PART_SIZE_CHANGED The part size is different from the size of one of the previous parts in the same file
117-
FILE_PART_SIZE_INVALID 512 KB cannot be evenly divided by part_size
118-
FILE_PART_TOO_BIG The size limit (512 KB) for the content of the file part has been exceeded
117+
FILE_PART_SIZE_INVALID The file part size is invalid
118+
FILE_PART_TOO_BIG The size limit for the content of the file part has been exceeded
119119
FILE_PART_X_MISSING Part {value} of the file is missing from storage
120120
FILE_REFERENCE_EMPTY The file id contains an empty file reference, you must obtain a valid one by fetching the message from the origin context
121121
FILE_REFERENCE_EXPIRED The file id contains an expired file reference, you must obtain a valid one by fetching the message from the origin context
@@ -162,7 +162,7 @@ LOCATION_INVALID The file location is invalid
162162
MAX_ID_INVALID The max_id parameter is invalid
163163
MAX_QTS_INVALID The provided QTS is invalid
164164
MD5_CHECKSUM_INVALID The file's checksum did not match the md5_checksum parameter
165-
MEDIA_CAPTION_TOO_LONG The media caption is longer than 1024 characters
165+
MEDIA_CAPTION_TOO_LONG The media caption is too long
166166
MEDIA_EMPTY The media you tried to send is invalid
167167
MEDIA_INVALID The media is invalid
168168
MEDIA_NEW_INVALID The new media to edit the message with is invalid
@@ -176,7 +176,7 @@ MESSAGE_IDS_EMPTY The requested message doesn't exist or you provided no message
176176
MESSAGE_ID_INVALID The message id is invalid
177177
MESSAGE_NOT_MODIFIED The message was not modified because you tried to edit it using the same content
178178
MESSAGE_POLL_CLOSED You can't interact with a closed poll
179-
MESSAGE_TOO_LONG The message text is over 4096 characters
179+
MESSAGE_TOO_LONG The message text is too long
180180
METHOD_INVALID The API method is invalid and cannot be used
181181
MSG_ID_INVALID The message ID used in the peer was invalid
182182
MSG_WAIT_FAILED A waiting call returned an error
@@ -225,7 +225,7 @@ PHOTO_FILE_MISSING Profile photo file missing
225225
PHOTO_ID_INVALID The photo id is invalid
226226
PHOTO_INVALID The photo is invalid
227227
PHOTO_INVALID_DIMENSIONS The photo dimensions are invalid
228-
PHOTO_SAVE_FILE_INVALID The photo you tried to send cannot be saved by Telegram. A reason may be that it exceeds 10 MB. Try resizing it locally
228+
PHOTO_SAVE_FILE_INVALID The photo you tried to send cannot be saved by Telegram
229229
PHOTO_THUMB_URL_EMPTY The photo thumb URL is empty
230230
PHOTO_THUMB_URL_INVALID The photo thumb URL is invalid
231231
PINNED_DIALOGS_TOO_MUCH Too many pinned dialogs
@@ -268,9 +268,9 @@ SCHEDULE_BOT_NOT_ALLOWED Bots are not allowed to schedule messages
268268
SCHEDULE_DATE_INVALID Invalid schedule date provided
269269
SCHEDULE_DATE_TOO_LATE The date you tried to schedule is too far in the future (more than one year)
270270
SCHEDULE_STATUS_PRIVATE You cannot schedule a message until the person comes online if their privacy does not show this information
271-
SCHEDULE_TOO_MUCH You cannot schedule more than 100 messages in this chat
271+
SCHEDULE_TOO_MUCH You tried to schedule too many messages in this chat
272272
SEARCH_QUERY_EMPTY The search query is empty
273-
SECONDS_INVALID The seconds interval is invalid, for slow mode try with 0 (off), 10, 30, 60 (1m), 300 (5m), 900 (15m) or 3600 (1h)
273+
SECONDS_INVALID The seconds interval is invalid
274274
SEND_MESSAGE_MEDIA_INVALID The message media is invalid
275275
SEND_MESSAGE_TYPE_INVALID The message type is invalid
276276
SESSION_TOO_FRESH_X You can't do this action because the current session was logged-in recently

docs/source/faq/how-to-avoid-flood-waits.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The following shows how to catch the exception in your code and wait the require
1616
try:
1717
... # Your code
1818
except FloodWait as e:
19-
await asyncio.sleep(e.x) # Wait "x" seconds before continuing
19+
await asyncio.sleep(e.value) # Wait "value" seconds before continuing
2020
...
2121
2222

docs/source/faq/socket-send-raised-exception-oserror-timeouterror.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
socket.send() raised exception, OSError(), TimeoutError()
22
=========================================================
33

4-
If you get this error chances are you are blocking the event loop for too long, most likely due to an improper use of
5-
non-asynchronous or threaded operations which may lead to blocking code that prevents the event loop from running
6-
properly.
4+
If you get this error chances are you or Telegram ended up with a slow or inconsistent network connection, which
5+
triggers internal timeouts due to data not being sent/received in time. Another reason could be because you are blocking
6+
the event loop for too long, most likely due to an improper use of non-asynchronous or threaded operations which may
7+
lead to blocking code that prevents the event loop from running properly.
78

89
You can consider the following:
910

docs/source/topics/advanced-usage.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Here's some examples:
5151
from pyrogram.raw import functions
5252
5353
async with Client("my_account") as app:
54-
await app.send(
54+
await app.invoke(
5555
functions.account.UpdateProfile(
5656
first_name="First Name", last_name="Last Name",
5757
about="New bio text"
@@ -67,10 +67,10 @@ Here's some examples:
6767
6868
async with Client("my_account") as app:
6969
# Set online status
70-
await app.send(functions.account.UpdateStatus(offline=False))
70+
await app.invoke(functions.account.UpdateStatus(offline=False))
7171
7272
# Set offline status
73-
await app.send(functions.account.UpdateStatus(offline=True))
73+
await app.invoke(functions.account.UpdateStatus(offline=True))
7474
7575
- Get chat info:
7676

@@ -80,7 +80,7 @@ Here's some examples:
8080
from pyrogram.raw import functions, types
8181
8282
async with Client("my_account") as app:
83-
r = await app.send(
83+
r = await app.invoke(
8484
functions.channels.GetFullChannel(
8585
channel=app.resolve_peer("username")
8686
)

0 commit comments

Comments
 (0)