Pyrogram: Cleanup

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2022-12-14 12:35:47 +07:00
parent e38ceb08cc
commit 86883a3b91
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
2 changed files with 10 additions and 5 deletions

View file

@ -891,9 +891,6 @@ class Message(Object, Update):
)
if message.reply_to:
parsed_message.reply_to_message_id = message.reply_to.reply_to_msg_id
parsed_message.reply_to_top_message_id = message.reply_to.reply_to_top_id
if message.reply_to.forum_topic:
if message.reply_to.reply_to_top_id:
thread_id = message.reply_to.reply_to_top_id
@ -903,6 +900,10 @@ class Message(Object, Update):
parsed_message.message_thread_id = thread_id
if topics:
parsed_message.topics = types.ForumTopic._parse(topics[thread_id])
else:
msg = await client.get_messages(parsed_message.chat.id,message.id)
if getattr(msg, "topics"):
parsed_message.topics = msg.topics
else:
parsed_message.reply_to_message_id = message.reply_to.reply_to_msg_id
parsed_message.reply_to_top_message_id = message.reply_to.reply_to_top_id

View file

@ -130,8 +130,12 @@ async def parse_messages(
reply_id = messages_with_replies.get(message.id, None)
for reply in reply_messages:
if reply.id == reply_id and not reply.forum_topic_created:
message.reply_to_message = reply
if reply.id == reply_id:
#if reply.forum_topic_created:
# message.reply_to_message_id = None
#else:
if not reply.forum_topic_created:
message.reply_to_message = reply
return types.List(parsed_messages)