From df3524e138cfb41e9335b6f2780902c5c884789d Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 27 Oct 2019 10:12:33 +0100 Subject: [PATCH 1/4] Add REPLY_MARKUP_TOO_LONG 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 82726bd3..73445b5e 100644 --- a/compiler/error/source/400_BAD_REQUEST.tsv +++ b/compiler/error/source/400_BAD_REQUEST.tsv @@ -130,4 +130,5 @@ CHANNELS_TOO_MUCH You have joined too many channels or supergroups ADMIN_RANK_INVALID The custom administrator title is invalid or is longer than 16 characters ADMIN_RANK_EMOJI_NOT_ALLOWED Emojis are not allowed in custom administrator titles FILE_REFERENCE_EMPTY The file reference is empty -FILE_REFERENCE_INVALID The file reference is invalid \ No newline at end of file +FILE_REFERENCE_INVALID The file reference is invalid +REPLY_MARKUP_TOO_LONG The reply markup is too long From 012369005e861402dee70313644ffe552406565d Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 27 Oct 2019 10:13:18 +0100 Subject: [PATCH 2/4] Remove an MTProto-only feature hint that's not valid anymore --- docs/source/topics/mtproto-vs-botapi.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/source/topics/mtproto-vs-botapi.rst b/docs/source/topics/mtproto-vs-botapi.rst index cad84251..b0e46a7f 100644 --- a/docs/source/topics/mtproto-vs-botapi.rst +++ b/docs/source/topics/mtproto-vs-botapi.rst @@ -73,12 +73,6 @@ HTTP Bot API. Using Pyrogram you can: - :guilabel:`--` The Bot API types often miss some useful information about Telegram entities and some of the methods are limited as well. -.. hlist:: - :columns: 1 - - - :guilabel:`+` **Get information about any public chat by usernames, even if not a member** - - :guilabel:`--` The Bot API simply doesn't support this - .. hlist:: :columns: 1 From 227a5aaf9010a56cc4a688b6a0b9861755927189 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 27 Oct 2019 10:13:59 +0100 Subject: [PATCH 3/4] Add FAQ about why stop, restart, add/remove_handler could make the code hang --- docs/source/faq.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/source/faq.rst b/docs/source/faq.rst index 203dde8a..cc9e5b60 100644 --- a/docs/source/faq.rst +++ b/docs/source/faq.rst @@ -253,6 +253,19 @@ contact people using official apps. The answer is the same for Pyrogram too and for usernames, meeting them in a common group, have their phone contacts saved or getting a message mentioning them, either a forward or a mention in the message text. +Code hangs when I stop, restart, add/remove_handler +--------------------------------------------------- + +You tried to ``.stop()``, ``.restart()``, ``.add_handler()`` or ``.remove_handler()`` *inside* a running handler, but +that can't be done because the way Pyrogram deals with handlers would make it hang. + +When calling one of the methods above inside an event handler, Pyrogram needs to wait for all running handlers to finish +in order to safely continue. In other words, since your handler is blocking the execution by waiting for the called +method to finish and since Pyrogram needs to wait for your handler to finish, you are left with a deadlock. + +The solution to this problem is to pass ``block=False`` to such methods so that they return immediately and the actual +code called asynchronously. + UnicodeEncodeError: '' codec can't encode … ----------------------------------------------------- From c33a2a0b8021ac2902edbda90a59ed2f2e242ef5 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 27 Oct 2019 10:14:13 +0100 Subject: [PATCH 4/4] Tiny typo fix --- pyrogram/client/handlers/disconnect_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/client/handlers/disconnect_handler.py b/pyrogram/client/handlers/disconnect_handler.py index 1b4801b2..ab2cf342 100644 --- a/pyrogram/client/handlers/disconnect_handler.py +++ b/pyrogram/client/handlers/disconnect_handler.py @@ -21,7 +21,7 @@ from .handler import Handler class DisconnectHandler(Handler): """The Disconnect handler class. Used to handle disconnections. It is intended to be used with - :meth:~Client.add_handler` + :meth:`~Client.add_handler` For a nicer way to register this handler, have a look at the :meth:`~Client.on_disconnect` decorator.