From ad2d45bca1c0f8f7df82848bcd31a0a65cdd2bcf Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 20 Jun 2019 13:54:46 +0200 Subject: [PATCH 1/5] Add BUTTON_DATA_INVALID error --- compiler/error/source/400_BAD_REQUEST.tsv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/error/source/400_BAD_REQUEST.tsv b/compiler/error/source/400_BAD_REQUEST.tsv index 8e82c9f6..389f99ab 100644 --- a/compiler/error/source/400_BAD_REQUEST.tsv +++ b/compiler/error/source/400_BAD_REQUEST.tsv @@ -105,4 +105,5 @@ MEGAGROUP_PREHISTORY_HIDDEN The action failed because the supergroup has the pre CHAT_LINK_EXISTS The action failed because the supergroup is linked to a channel LINK_NOT_MODIFIED The chat link was not modified because you tried to link to the same target BROADCAST_ID_INVALID The channel is invalid -MEGAGROUP_ID_INVALID The supergroup is invalid \ No newline at end of file +MEGAGROUP_ID_INVALID The supergroup is invalid +BUTTON_DATA_INVALID The button callback data contains invalid data or exceeds 64 bytes \ No newline at end of file From 36757c125cc4f67f4d48a3538b50ff4e7a22a5e8 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 20 Jun 2019 13:55:05 +0200 Subject: [PATCH 2/5] Tiny documentation fix --- docs/source/glossary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/glossary.rst b/docs/source/glossary.rst index d5a1bffd..80ae1ecc 100644 --- a/docs/source/glossary.rst +++ b/docs/source/glossary.rst @@ -29,7 +29,7 @@ Terms achieve high quality and availability for services. RPC - Acronym for Remote Procedure call, that is, a function which gets executed at some remote place (i.e. Telegram + Acronym for Remote Procedure Call, that is, a function which gets executed at some remote place (i.e. Telegram server) and not in your local machine. RPCError From 48197cb2228f0eb38c58fa72e66659a87dbdbe5e Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 20 Jun 2019 13:56:23 +0200 Subject: [PATCH 3/5] Update FAQ: Starting from v0.14.1 photo-like file id formats changed --- docs/source/faq.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/source/faq.rst b/docs/source/faq.rst index 449076af..05fa0bb5 100644 --- a/docs/source/faq.rst +++ b/docs/source/faq.rst @@ -1,6 +1,9 @@ Pyrogram FAQ ============ +.. role:: strike + :class: strike + This FAQ page provides answers to common questions about Pyrogram and, to some extent, Telegram in general. .. tip:: @@ -102,9 +105,11 @@ one: ``CAADBAADyg4AAvLQYAEYD4F7vcZ43AI``. Can I use Bot API's file_ids in Pyrogram? ----------------------------------------- -Definitely! All file ids you might have taken from the Bot API are 100% compatible and re-usable in Pyrogram... +:strike:`Definitely! All file ids you might have taken from the Bot API are 100% compatible and re-usable in Pyrogram.` -...at least for now. +Starting from :doc:`Pyrogram v0.14.1 (Layer 100) `, the file_id format of all photo-like objects has +changed. Types affected are: :obj:`~pyrogram.Thumbnail`, :obj:`~pyrogram.ChatPhoto` and :obj:`~pyrogram.Photo`. Any +other file id remains compatible with the Bot API. Telegram is slowly changing some server's internals and it's doing it in such a way that file ids are going to break inevitably. Not only this, but it seems that the new, hypothetical, file ids could also possibly expire at anytime, thus From 9ebf2983fe444770f180a110278e45071477b094 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 20 Jun 2019 14:15:02 +0200 Subject: [PATCH 4/5] Cast Paths to string: pathlib for older pythons doesn't properly work --- pyrogram/client/client.py | 2 +- pyrogram/client/storage/file_storage.py | 4 ++-- pyrogram/client/storage/memory_storage.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 2d18d178..e1bebeaf 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -990,7 +990,7 @@ class Client(Methods, BaseClient): def load_config(self): parser = ConfigParser() - parser.read(self.config_file) + parser.read(str(self.config_file)) if self.api_id and self.api_hash: pass diff --git a/pyrogram/client/storage/file_storage.py b/pyrogram/client/storage/file_storage.py index f52a03a9..e6ba8420 100644 --- a/pyrogram/client/storage/file_storage.py +++ b/pyrogram/client/storage/file_storage.py @@ -77,7 +77,7 @@ class FileStorage(MemoryStorage): if file_exists: try: - with open(path, encoding="utf-8") as f: + with open(str(path), encoding="utf-8") as f: session_json = json.load(f) except ValueError: pass @@ -98,7 +98,7 @@ class FileStorage(MemoryStorage): log.warning('Old session file detected: "{}.OLD". You can remove this file now'.format(path.name)) self.conn = sqlite3.connect( - path, + str(path), timeout=1, check_same_thread=False ) diff --git a/pyrogram/client/storage/memory_storage.py b/pyrogram/client/storage/memory_storage.py index 7eb3a7d0..bf000f35 100644 --- a/pyrogram/client/storage/memory_storage.py +++ b/pyrogram/client/storage/memory_storage.py @@ -46,7 +46,7 @@ class MemoryStorage(Storage): def create(self): with self.lock, self.conn: - with open(Path(__file__).parent / "schema.sql", "r") as schema: + with open(str(Path(__file__).parent / "schema.sql"), "r") as schema: self.conn.executescript(schema.read()) self.conn.execute( From 81e7c1b4eba9389e8bda64d49fab05419c090fef Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 20 Jun 2019 14:15:53 +0200 Subject: [PATCH 5/5] Add START_PARAM_INVALID error --- compiler/error/source/400_BAD_REQUEST.tsv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/error/source/400_BAD_REQUEST.tsv b/compiler/error/source/400_BAD_REQUEST.tsv index 389f99ab..43bade44 100644 --- a/compiler/error/source/400_BAD_REQUEST.tsv +++ b/compiler/error/source/400_BAD_REQUEST.tsv @@ -106,4 +106,5 @@ CHAT_LINK_EXISTS The action failed because the supergroup is linked to a channel LINK_NOT_MODIFIED The chat link was not modified because you tried to link to the same target BROADCAST_ID_INVALID The channel is invalid MEGAGROUP_ID_INVALID The supergroup is invalid -BUTTON_DATA_INVALID The button callback data contains invalid data or exceeds 64 bytes \ No newline at end of file +BUTTON_DATA_INVALID The button callback data contains invalid data or exceeds 64 bytes +START_PARAM_INVALID The start parameter is invalid \ No newline at end of file