🚑️ fix: message parse

This commit is contained in:
xtaodada 2023-01-27 00:24:14 +08:00
parent 8e48f32dce
commit 9211a7d843
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -379,13 +379,17 @@ class Message(pyrogram.types.Message):
replies: int = 1
):
parsed = await pyrogram.types.Message.old_parse(client, message, users, chats, is_scheduled, replies) # noqa
# forum_topic
parsed.forum_topic = getattr(message.reply_to, "forum_topic", None)
if isinstance(message, pyrogram.raw.types.Message) and message.reply_to \
and parsed.forum_topic and not message.reply_to.reply_to_top_id:
parsed.reply_to_top_message_id = parsed.reply_to_message_id
parsed.reply_to_message_id = None
parsed.reply_to_message = None
# forum topic
if isinstance(message, pyrogram.raw.types.Message):
parsed.forum_topic = getattr(message.reply_to, "forum_topic", None)
if (
message.reply_to
and parsed.forum_topic
and not message.reply_to.reply_to_top_id
):
parsed.reply_to_top_message_id = parsed.reply_to_message_id
parsed.reply_to_message_id = None
parsed.reply_to_message = None
# make message.text as message.caption
parsed.text = parsed.text or parsed.caption
return parsed