From c196b90c9d1f73cbd72615131a97d0d703ef814b Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 6 Jul 2020 15:55:11 +0200 Subject: [PATCH 1/3] Allow uploading files up to 2000 MiB in size --- pyrogram/client/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 5f52bfc0..0e186d85 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1772,8 +1772,8 @@ class Client(Methods, BaseClient): if file_size == 0: raise ValueError("File size equals to 0 B") - if file_size > 1500 * 1024 * 1024: - raise ValueError("Telegram doesn't support uploading files bigger than 1500 MiB") + if file_size > 2000 * 1024 * 1024: + raise ValueError("Telegram doesn't support uploading files bigger than 2000 MiB") file_total_parts = int(math.ceil(file_size / part_size)) is_big = True if file_size > 10 * 1024 * 1024 else False From db7fc68efe9c576b2f59a264d60496b1e4e7be28 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 6 Jul 2020 16:01:37 +0200 Subject: [PATCH 2/3] Update FILE_PART(S)_INVALID error message Telegram now allows uploads up to 2000 MiB in size (4000 parts) --- compiler/error/source/400_BAD_REQUEST.tsv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/error/source/400_BAD_REQUEST.tsv b/compiler/error/source/400_BAD_REQUEST.tsv index 8b4d8709..ba6f6815 100644 --- a/compiler/error/source/400_BAD_REQUEST.tsv +++ b/compiler/error/source/400_BAD_REQUEST.tsv @@ -12,8 +12,8 @@ PHONE_NUMBER_UNOCCUPIED The phone number is not yet being used USERS_TOO_FEW Not enough users (to create a chat, for example) USERS_TOO_MUCH The maximum number of users has been exceeded (to create a chat, for example) TYPE_CONSTRUCTOR_INVALID The type constructor is invalid -FILE_PART_INVALID The file part number is invalid. The value is not between 0 and 2999 -FILE_PARTS_INVALID Invalid number of parts. The value is not between 1 and 3000 +FILE_PART_INVALID The file part number is invalid. The value is not between 0 and 3999 +FILE_PARTS_INVALID Invalid number of parts. The value is not between 1 and 4000 FILE_PART_X_MISSING Part {x} of the file is missing from storage MD5_CHECKSUM_INVALID The file's checksum did not match the md5_checksum parameter PHOTO_INVALID_DIMENSIONS The photo dimensions are invalid @@ -144,4 +144,4 @@ FRESH_CHANGE_ADMINS_FORBIDDEN Recently logged-in users cannot change admins BROADCAST_PUBLIC_VOTERS_FORBIDDEN Polls with public voters cannot be sent in channels INPUT_FILTER_INVALID The filter is invalid for this query EMOTICON_EMPTY The emoticon parameter is empty -EMOTICON_INVALID The emoticon parameter is invalid \ No newline at end of file +EMOTICON_INVALID The emoticon parameter is invalid From 37d823f5792bec295536bc147642be70f18caa10 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 6 Jul 2020 16:07:06 +0200 Subject: [PATCH 3/3] Fix linked chat parsing There are two distinct ChatFull types using the same name (but different namespaces), their objects are kept in chat_full and full_chat. --- pyrogram/client/types/user_and_chats/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/client/types/user_and_chats/chat.py b/pyrogram/client/types/user_and_chats/chat.py index d95c5b37..fe103573 100644 --- a/pyrogram/client/types/user_and_chats/chat.py +++ b/pyrogram/client/types/user_and_chats/chat.py @@ -252,7 +252,7 @@ class Chat(Object): if full_chat.id == c.id: chat = c - if isinstance(chat_full, types.ChannelFull): + if isinstance(full_chat, types.ChannelFull): if full_chat.linked_chat_id == c.id: linked_chat = c