From ede9af3e008c616434ae9b0aca3ea6c27ff125d3 Mon Sep 17 00:00:00 2001 From: wulan17 Date: Sat, 17 Dec 2022 15:27:03 +0700 Subject: [PATCH] Pyrogram: types: Message: Add error handling and is_topic_message Signed-off-by: wulan17 --- pyrogram/types/messages_and_media/message.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 373ed236..41f2d1fe 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -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