2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Add fallback for any unsupported media

This commit is contained in:
Dan 2018-04-05 20:44:11 +02:00
parent 3229d36556
commit f3fcfb17df

View File

@ -355,16 +355,18 @@ def parse_message(
mime_type=doc.mime_type, mime_type=doc.mime_type,
file_size=doc.size file_size=doc.size
) )
else:
media = None
m = pyrogram.Message( m = pyrogram.Message(
message_id=message.id, message_id=message.id,
date=message.date, date=message.date,
chat=parse_chat(message, users, chats), chat=parse_chat(message, users, chats),
from_user=parse_user(users.get(message.from_id, None)), from_user=parse_user(users.get(message.from_id, None)),
text=message.message or None if message.media is None else None, text=message.message or None if media is None else None,
caption=message.message or None if message.media is not None else None, caption=message.message or None if media is not None else None,
entities=entities or None if message.media is None else None, entities=entities or None if media is None else None,
caption_entities=entities or None if message.media is not None else None, caption_entities=entities or None if media is not None else None,
author_signature=message.post_author, author_signature=message.post_author,
forward_from=forward_from, forward_from=forward_from,
forward_from_chat=forward_from_chat, forward_from_chat=forward_from_chat,