From b8934ae17c9b47448648f4b387ee44701b87d4ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joscha=20G=C3=B6tzer?= Date: Tue, 1 Dec 2020 21:55:33 +0100 Subject: [PATCH 1/2] Don't process MessageEmpty in get_dialogs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevent ``` File "C:\Users\INT002327\AppData\Local\pypoetry\Cache\virtualenvs\josxabot-c3BmTbt9-py3.8\lib\site-packages\pyrogram\methods\chats\get_dialogs.py", line 92, in get_dialogs to_id = message.to_id └ pyrogram.raw.types.MessageEmpty(id=2767691) AttributeError: 'MessageEmpty' object has no attribute 'to_id' ``` --- pyrogram/methods/chats/get_dialogs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyrogram/methods/chats/get_dialogs.py b/pyrogram/methods/chats/get_dialogs.py index b437012b..c05e6d02 100644 --- a/pyrogram/methods/chats/get_dialogs.py +++ b/pyrogram/methods/chats/get_dialogs.py @@ -89,6 +89,9 @@ class GetDialogs(Scaffold): messages = {} for message in r.messages: + if message.empty: + continue + peer_id = message.peer_id if isinstance(peer_id, raw.types.PeerUser): From ff0fa9cbc3234299e02bd6fbbba6eb1f5d0d24cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joscha=20G=C3=B6tzer?= Date: Thu, 3 Dec 2020 02:51:03 +0100 Subject: [PATCH 2/2] Update get_dialogs.py --- pyrogram/methods/chats/get_dialogs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/methods/chats/get_dialogs.py b/pyrogram/methods/chats/get_dialogs.py index c05e6d02..487e8f8d 100644 --- a/pyrogram/methods/chats/get_dialogs.py +++ b/pyrogram/methods/chats/get_dialogs.py @@ -89,7 +89,7 @@ class GetDialogs(Scaffold): messages = {} for message in r.messages: - if message.empty: + if isinstance(message, raw.types.MessageEmpty): continue peer_id = message.peer_id