mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Added ForumTopic class and fixed previous classes by fixing de_json method.
This commit is contained in:
parent
7958d0dca7
commit
876d679765
@ -6779,10 +6779,11 @@ class ForumTopicCreated(JsonDeserializable):
|
|||||||
:return: Instance of the class
|
:return: Instance of the class
|
||||||
:rtype: :class:`telebot.types.ForumTopicCreated`
|
:rtype: :class:`telebot.types.ForumTopicCreated`
|
||||||
"""
|
"""
|
||||||
def de_json(self, json_string):
|
@classmethod
|
||||||
|
def de_json(cls, json_string):
|
||||||
if json_string is None: return None
|
if json_string is None: return None
|
||||||
obj = self.check_json(json_string)
|
obj = cls.check_json(json_string)
|
||||||
return self(**obj)
|
return cls(**obj)
|
||||||
|
|
||||||
def __init__(self, name: str, icon_color: int, icon_custom_emoji_id: Optional[str]=None) -> None:
|
def __init__(self, name: str, icon_color: int, icon_custom_emoji_id: Optional[str]=None) -> None:
|
||||||
self.name: str = name
|
self.name: str = name
|
||||||
@ -6793,8 +6794,9 @@ class ForumTopicCreated(JsonDeserializable):
|
|||||||
class ForumTopicClosed(JsonDeserializable):
|
class ForumTopicClosed(JsonDeserializable):
|
||||||
"""This object represents a service message about a forum topic closed in the chat. Currently holds no information."""
|
"""This object represents a service message about a forum topic closed in the chat. Currently holds no information."""
|
||||||
# for future use
|
# for future use
|
||||||
def de_json(self, json_string):
|
@classmethod
|
||||||
return self()
|
def de_json(cls, json_string):
|
||||||
|
return cls()
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
pass
|
pass
|
||||||
@ -6803,13 +6805,45 @@ class ForumTopicClosed(JsonDeserializable):
|
|||||||
class ForumTopicReopened(JsonDeserializable):
|
class ForumTopicReopened(JsonDeserializable):
|
||||||
"""This object represents a service message about a forum topic reopened in the chat. Currently holds no information."""
|
"""This object represents a service message about a forum topic reopened in the chat. Currently holds no information."""
|
||||||
# for future use
|
# for future use
|
||||||
def de_json(self, json_string):
|
@classmethod
|
||||||
return self()
|
def de_json(cls, json_string):
|
||||||
|
return cls()
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ForumTopic(JsonDeserializable):
|
||||||
|
"""
|
||||||
|
This object represents a forum topic.
|
||||||
|
|
||||||
|
:param message_thread_id: Unique identifier of the forum topic
|
||||||
|
:type message_thread_id: :obj:`int`
|
||||||
|
|
||||||
|
:param name: Name of the topic
|
||||||
|
:type name: :obj:`str`
|
||||||
|
|
||||||
|
:param icon_color: Color of the topic icon in RGB format
|
||||||
|
:type icon_color: :obj:`int`
|
||||||
|
|
||||||
|
:param icon_custom_emoji_id: Optional. Unique identifier of the custom emoji shown as the topic icon
|
||||||
|
:type icon_custom_emoji_id: :obj:`str`
|
||||||
|
"""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def de_json(cls, json_string):
|
||||||
|
if json_string is None: return None
|
||||||
|
obj = cls.check_json(json_string)
|
||||||
|
return cls(**obj)
|
||||||
|
|
||||||
|
def __init__(self, message_thread_id: int, name: str, icon_color: int, icon_custom_emoji_id: Optional[str]=None) -> None:
|
||||||
|
self.message_thread_id: int = message_thread_id
|
||||||
|
self.name: str = name
|
||||||
|
self.icon_color: int = icon_color
|
||||||
|
self.icon_custom_emoji_id: Optional[str] = icon_custom_emoji_id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user