iShotaBot/models/temp_fix.py

37 lines
968 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,
2024-06-07 15:38:42 +00:00
topics: dict = None,
2022-11-24 07:08:30 +00:00
is_scheduled: bool = False,
2023-01-12 13:19:54 +00:00
replies: int = 1,
2024-06-07 15:38:42 +00:00
business_connection_id: str = None,
2024-07-17 12:16:19 +00:00
reply_to_message: "raw.base.Message" = None,
2022-11-24 07:08:30 +00:00
):
2023-01-12 13:19:54 +00:00
parsed = await pyrogram.types.Message.old_parse(
2024-07-17 12:16:19 +00:00
client,
message,
users,
chats,
topics,
is_scheduled,
replies,
business_connection_id,
reply_to_message,
2023-01-12 13:19:54 +00:00
) # 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