pyrofork: Fix forum topic type hints

Signed-off-by: Yasir <git@yasir.id>
This commit is contained in:
KurimuzonAkuma 2025-01-09 08:27:53 +07:00 committed by Yasir
parent 7cda52ac39
commit b12b4a62f4
2 changed files with 30 additions and 17 deletions

View file

@ -25,17 +25,17 @@ class ForumTopicCreated(Object):
Parameters:
id (``Integer``):
id (``int``):
Id of the topic
title (``String``):
title (``str``):
Name of the topic.
icon_color (``Integer``):
Color of the topic icon in RGB format
icon_color (``int``):
Color of the topic icon in decimal format.
icon_emoji_id (``Integer``, *optional*):
Unique identifier of the custom emoji shown as the topic icon
custom_emoji_id (``int``, *optional*):
Unique identifier of the custom emoji shown as the topic icon.
"""
def __init__(
@ -43,14 +43,14 @@ class ForumTopicCreated(Object):
id: int,
title: str,
icon_color: int,
icon_emoji_id: int = None
custom_emoji_id: int = None
):
super().__init__()
self.id = id
self.title = title
self.icon_color = icon_color
self.icon_emoji_id = icon_emoji_id
self.custom_emoji_id = custom_emoji_id
@staticmethod
def _parse(message: "raw.base.Message") -> "ForumTopicCreated":
@ -60,5 +60,5 @@ class ForumTopicCreated(Object):
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)
custom_emoji_id=getattr(message.action,"icon_emoji_id", None)
)

View file

@ -25,27 +25,38 @@ class ForumTopicEdited(Object):
Parameters:
title (``String``):
title (``str``):
Name of the topic.
icon_color (``Integer``):
Color of the topic icon in RGB format
icon_color (``int``):
Color of the topic icon in decimal format.
icon_custom_emoji_id (``String``, *optional*):
Unique identifier of the custom emoji shown as the topic icon
custom_emoji_id (``str``, *optional*):
Unique identifier of the custom emoji shown as the topic icon.
is_closed (``bool``, *optional*):
True, if the topic is closed.
is_hidden (``bool``, *optional*):
True, if the topic is hidden.
Valid only for the "General" topic with id=1
"""
def __init__(
self, *,
title: str = None,
icon_color: int = None,
icon_emoji_id: str = None
custom_emoji_id: int = None,
is_closed: bool = None,
is_hidden: bool = None
):
super().__init__()
self.title = title
self.icon_color = icon_color
self.icon_emoji_id = icon_emoji_id
self.custom_emoji_id = custom_emoji_id
self.is_closed = is_closed
self.is_hidden = is_hidden
@staticmethod
def _parse(action: "raw.types.MessageActionTopicEdit") -> "ForumTopicEdited":
@ -54,5 +65,7 @@ class ForumTopicEdited(Object):
return ForumTopicEdited(
title=getattr(action,"title", None),
icon_color=getattr(action,"icon_color", None),
icon_emoji_id=getattr(action,"icon_emoji_id", None)
custom_emoji_id=getattr(action, "icon_emoji_id", None),
is_closed=getattr(action, "closed", None),
is_hidden=getattr(action, "hidden", None)
)