From e1ff81f93fd4caf94ab53fb277e30b588f7fa17b Mon Sep 17 00:00:00 2001 From: wulan17 Date: Sat, 9 Sep 2023 14:57:08 +0700 Subject: [PATCH] Pyrofork: Add topic id to topic created services messages Signed-off-by: wulan17 --- pyrogram/methods/chats/create_forum_topic.py | 2 +- .../types/user_and_chats/forum_topic_created.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pyrogram/methods/chats/create_forum_topic.py b/pyrogram/methods/chats/create_forum_topic.py index 4e9bb95c5..f0ed4a57e 100644 --- a/pyrogram/methods/chats/create_forum_topic.py +++ b/pyrogram/methods/chats/create_forum_topic.py @@ -64,4 +64,4 @@ async def create_forum_topic( ) ) - return types.ForumTopicCreated._parse(r.updates[1].message.action) + return types.ForumTopicCreated._parse(r.updates[1].message) diff --git a/pyrogram/types/user_and_chats/forum_topic_created.py b/pyrogram/types/user_and_chats/forum_topic_created.py index ed058760c..da7daaccc 100644 --- a/pyrogram/types/user_and_chats/forum_topic_created.py +++ b/pyrogram/types/user_and_chats/forum_topic_created.py @@ -25,6 +25,9 @@ class ForumTopicCreated(Object): Parameters: + id (``Integer``): + Id of the topic + title (``String``): Name of the topic. @@ -37,22 +40,25 @@ class ForumTopicCreated(Object): def __init__( self, *, + id: int, title: str, icon_color: int, icon_emoji_id: int = None ): super().__init__() + self.id = id self.title = title self.icon_color = icon_color self.icon_emoji_id = icon_emoji_id @staticmethod - def _parse(action: "raw.types.MessageActionTopicCreate") -> "ForumTopicCreated": + def _parse(message: "raw.base.Message") -> "ForumTopicCreated": return ForumTopicCreated( - title=getattr(action,"title", None), - icon_color=getattr(action,"icon_color", None), - icon_emoji_id=getattr(action,"icon_emoji_id", None) + id=getattr(message, "id", None), + title=getattr(message.action,"title", None), + icon_color=getattr(message.action,"icon_color", None), + icon_emoji_id=getattr(message.action,"icon_emoji_id", None) )