mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-06 15:14:52 +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
|
user_shared = action.peer.user_id
|
||||||
service_type = enums.MessageServiceType.UserShared
|
service_type = enums.MessageServiceType.UserShared
|
||||||
elif isinstance(action, raw.types.MessageActionTopicCreate):
|
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
|
service_type = enums.MessageServiceType.FORUM_TOPIC_CREATED
|
||||||
elif isinstance(action, raw.types.MessageActionTopicEdit):
|
elif isinstance(action, raw.types.MessageActionTopicEdit):
|
||||||
if action.title:
|
if action.title:
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@ class ForumTopicCreated(Object):
|
||||||
|
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
id (``Integer``):
|
||||||
|
Id of the topic
|
||||||
|
|
||||||
title (``String``):
|
title (``String``):
|
||||||
Name of the topic.
|
Name of the topic.
|
||||||
|
|
||||||
|
|
@ -37,22 +40,25 @@ class ForumTopicCreated(Object):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, *,
|
self, *,
|
||||||
|
id: int,
|
||||||
title: str,
|
title: str,
|
||||||
icon_color: int,
|
icon_color: int,
|
||||||
icon_emoji_id: int = None
|
icon_emoji_id: int = None
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
self.id = id
|
||||||
self.title = title
|
self.title = title
|
||||||
self.icon_color = icon_color
|
self.icon_color = icon_color
|
||||||
self.icon_emoji_id = icon_emoji_id
|
self.icon_emoji_id = icon_emoji_id
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse(action: "raw.types.MessageActionTopicCreate") -> "ForumTopicCreated":
|
def _parse(message: "raw.base.Message") -> "ForumTopicCreated":
|
||||||
|
|
||||||
|
|
||||||
return ForumTopicCreated(
|
return ForumTopicCreated(
|
||||||
title=getattr(action,"title", None),
|
id=getattr(message, "id", None),
|
||||||
icon_color=getattr(action,"icon_color", None),
|
title=getattr(message.action,"title", None),
|
||||||
icon_emoji_id=getattr(action,"icon_emoji_id", 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