mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Pyrofork: Add topic id to topic created services messages
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
24dfde46ce
commit
b3a642dc24
3 changed files with 12 additions and 6 deletions
|
|
@ -64,4 +64,4 @@ class CreateForumTopic:
|
|||
)
|
||||
)
|
||||
|
||||
return types.ForumTopicCreated._parse(r.updates[1].message.action)
|
||||
return types.ForumTopicCreated._parse(r.updates[1].message)
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ class Message(Object, Update):
|
|||
user_shared = action.peer.user_id
|
||||
service_type = enums.MessageServiceType.UserShared
|
||||
elif isinstance(action, raw.types.MessageActionTopicCreate):
|
||||
forum_topic_created = types.ForumTopicCreated._parse(action)
|
||||
forum_topic_created = types.ForumTopicCreated._parse(message)
|
||||
service_type = enums.MessageServiceType.FORUM_TOPIC_CREATED
|
||||
elif isinstance(action, raw.types.MessageActionTopicEdit):
|
||||
if action.title:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue