Skip to content

Commit 0e125ab

Browse files
Added the class ChatBoostAdded and the field boost_added to the class Message for service messages about a user boosting a chat.
1 parent 54a02d7 commit 0e125ab

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

telebot/types.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,9 @@ class Message(JsonDeserializable):
10121012
proximity alert while sharing Live Location.
10131013
:type proximity_alert_triggered: :class:`telebot.types.ProximityAlertTriggered`
10141014
1015+
:param boost_added: Optional. Service message: user boosted the chat
1016+
:type boost_added: :class:`telebot.types.ChatBoostAdded`
1017+
10151018
:param forum_topic_created: Optional. Service message: forum topic created
10161019
:type forum_topic_created: :class:`telebot.types.ForumTopicCreated`
10171020
@@ -1275,6 +1278,10 @@ def de_json(cls, json_string):
12751278
content_type = 'giveaway_completed'
12761279
if 'forward_origin' in obj:
12771280
opts['forward_origin'] = MessageOrigin.de_json(obj['forward_origin'])
1281+
if 'boost_added' in obj:
1282+
opts['boost_added'] = ChatBoostAdded.de_json(obj['boost_added'])
1283+
content_type = 'boost_added'
1284+
12781285

12791286
return cls(message_id, from_user, date, chat, content_type, opts, json_string)
12801287

@@ -1375,6 +1382,7 @@ def __init__(self, message_id, from_user, date, chat, content_type, options, jso
13751382
self.giveaway_winners: Optional[GiveawayWinners] = None
13761383
self.giveaway_completed: Optional[GiveawayCompleted] = None
13771384
self.forward_origin: Optional[MessageOrigin] = None
1385+
self.boost_added: Optional[ChatBoostAdded] = None
13781386

13791387
for key in options:
13801388
setattr(self, key, options[key])
@@ -9262,3 +9270,27 @@ def __getattr__(self, item):
92629270
return self.__universal_deprecation(item)
92639271
else:
92649272
raise AttributeError(f'"{self.__class__.__name__}" object has no attribute "{item}"')
9273+
9274+
9275+
class ChatBoostAdded(JsonDeserializable):
9276+
"""
9277+
This object represents a service message about a user boosting a chat.
9278+
9279+
Telegram documentation: https://core.telegram.org/bots/api#chatboostadded
9280+
9281+
:param boost_count: Number of boosts added by the user
9282+
:type boost_count: :obj:`int`
9283+
9284+
:return: Instance of the class
9285+
:rtype: :class:`ChatBoostAdded`
9286+
"""
9287+
9288+
@classmethod
9289+
def de_json(cls, json_string):
9290+
if json_string is None:
9291+
return None
9292+
obj = cls.check_json(json_string)
9293+
return cls(**obj)
9294+
9295+
def __init__(self, boost_count, **kwargs):
9296+
self.boost_count: int = boost_count

0 commit comments

Comments
 (0)