Pyrogram: types: Message: Add error handling and is_topic_message

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2022-12-17 15:27:03 +07:00
parent abf1b2fece
commit ede9af3e00
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -908,12 +908,16 @@ class Message(Object, Update):
else:
thread_id = message.reply_to.reply_to_msg_id
parsed_message.message_thread_id = thread_id
parsed_message.is_topic_message = True
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
try:
msg = await client.get_messages(parsed_message.chat.id,message.id)
if getattr(msg, "topics"):
parsed_message.topics = msg.topics
except Exception:
pass
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