@@ -929,6 +929,9 @@ class Message(JsonDeserializable):
929929 :param message_thread_id: Optional. Unique identifier of a message thread to which the message belongs; for supergroups only
930930 :type message_thread_id: :obj:`int`
931931
932+ :param direct_messages_topic: Optional. Information about the direct messages chat topic that contains the message
933+ :type direct_messages_topic: :class:`telebot.types.DirectMessagesTopic`
934+
932935 :param from_user: Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the
933936 field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
934937 :type from_user: :class:`telebot.types.User`
@@ -1499,6 +1502,8 @@ def de_json(cls, json_string):
14991502 content_type = 'direct_message_price_changed'
15001503 if 'reply_to_checklist_task_id' in obj:
15011504 opts['reply_to_checklist_task_id'] = obj['reply_to_checklist_task_id']
1505+ if 'direct_messages_topic' in obj:
1506+ opts['direct_messages_topic'] = DirectMessagesTopic.de_json(obj['direct_messages_topic'])
15021507
15031508 return cls(message_id, from_user, date, chat, content_type, opts, json_string)
15041509
@@ -1626,6 +1631,7 @@ def __init__(self, message_id, from_user, date, chat, content_type, options, jso
16261631 self.checklist_tasks_added: Optional[List[ChecklistTasksAdded]] = None
16271632 self.direct_message_price_changed: Optional[DirectMessagePriceChanged] = None
16281633 self.reply_to_checklist_task_id: Optional[int] = None
1634+ self.direct_messages_topic: Optional[DirectMessagesTopic] = None
16291635
16301636 for key in options:
16311637 setattr(self, key, options[key])
@@ -12888,3 +12894,32 @@ def de_json(cls, json_string):
1288812894 if json_string is None: return None
1288912895 obj = cls.check_json(json_string)
1289012896 return cls(**obj)
12897+
12898+
12899+ class DirectMessagesTopic(JsonDeserializable):
12900+ """
12901+ Describes a topic of a direct messages chat.
12902+
12903+ Telegram documentation: https://core.telegram.org/bots/api#directmessagestopic
12904+
12905+ :param topic_id: Unique identifier of the topic
12906+ :type topic_id: :obj:`int`
12907+
12908+ :param user: Optional. Information about the user that created the topic. Currently, it is always present
12909+ :type user: :class:`User`
12910+
12911+ :return: Instance of the class
12912+ :rtype: :class:`DirectMessagesTopic`
12913+ """
12914+ def __init__(self, topic_id: int, user: Optional[User] = None, **kwargs):
12915+ self.topic_id: int = topic_id
12916+ self.user: Optional[User] = user # for future compatibility, currently always present
12917+
12918+ @classmethod
12919+ def de_json(cls, json_string):
12920+ if json_string is None: return None
12921+ obj = cls.check_json(json_string)
12922+ if 'user' in obj:
12923+ obj['user'] = User.de_json(obj['user'])
12924+ return cls(**obj)
12925+
0 commit comments