iShotaBot/models/temp_fix.py

26 lines
739 B
Python
Raw Normal View History

2022-11-24 07:08:30 +00:00
import pyrogram
async def temp_fix(
client: "pyrogram.Client",
message: pyrogram.raw.base.Message,
users: dict,
chats: dict,
is_scheduled: bool = False,
2023-01-12 13:19:54 +00:00
replies: int = 1,
2022-11-24 07:08:30 +00:00
):
2023-01-12 13:19:54 +00:00
parsed = await pyrogram.types.Message.old_parse(
client, message, users, chats, is_scheduled, replies
) # noqa
if (
isinstance(message, pyrogram.raw.types.Message)
and message.reply_to
and hasattr(message.reply_to, "forum_topic")
and message.reply_to.forum_topic
and not message.reply_to.reply_to_top_id
):
2022-11-24 07:08:30 +00:00
parsed.reply_to_top_message_id = parsed.reply_to_message_id
parsed.reply_to_message_id = None
parsed.reply_to_message = None
return parsed