2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Add support for empty messages

This commit is contained in:
Dan 2018-04-23 18:16:32 +02:00
parent f6415cdc15
commit 88f7b35120

View File

@ -479,8 +479,8 @@ def parse_message(
) )
if message.reply_to_msg_id and replies: if message.reply_to_msg_id and replies:
m.reply_to_message = client.get_messages(m.chat.id, [message.reply_to_msg_id]) m.reply_to_message = client.get_messages(m.chat.id, message.reply_to_msg_id)
m.reply_to_message = m.reply_to_message[0] if m.reply_to_message else None m.reply_to_message = m.reply_to_message
return m return m
@ -579,7 +579,20 @@ def parse_message_service(
) )
if isinstance(action, types.MessageActionPinMessage): if isinstance(action, types.MessageActionPinMessage):
m.pinned_message = client.get_messages(m.chat.id, [message.reply_to_msg_id]) m.pinned_message = client.get_messages(m.chat.id, message.reply_to_msg_id)
m.pinned_message = m.pinned_message[0] if m.pinned_message else None m.pinned_message = m.pinned_message
return m return m
def parse_message_empty(
client,
message: types.MessageEmpty,
users: dict,
chats: dict
) -> pyrogram.Message:
return pyrogram.Message(
message_id=message.id,
date=None,
chat=None
)