From f3fcfb17df784579997125d34828634987463f37 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 5 Apr 2018 20:44:11 +0200 Subject: [PATCH] Add fallback for any unsupported media --- pyrogram/client/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pyrogram/client/utils.py b/pyrogram/client/utils.py index cf81c68d..2358db3c 100644 --- a/pyrogram/client/utils.py +++ b/pyrogram/client/utils.py @@ -355,16 +355,18 @@ def parse_message( mime_type=doc.mime_type, file_size=doc.size ) + else: + media = None m = pyrogram.Message( message_id=message.id, date=message.date, chat=parse_chat(message, users, chats), from_user=parse_user(users.get(message.from_id, None)), - text=message.message or None if message.media is None else None, - caption=message.message or None if message.media is not None else None, - entities=entities or None if message.media is None else None, - caption_entities=entities or None if message.media is not None else None, + text=message.message or None if media is None else None, + caption=message.message or None if media is not None else None, + entities=entities or None if media is None else None, + caption_entities=entities or None if media is not None else None, author_signature=message.post_author, forward_from=forward_from, forward_from_chat=forward_from_chat,