Skip to content

Commit 54b41ed

Browse files
Added the field publisher_chat to the classes Gift and UniqueGift which can be used to get information about the chat that published a gift.
1 parent 9a58fda commit 54b41ed

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

telebot/types.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11272,23 +11272,30 @@ class Gift(JsonDeserializable):
1127211272
:param remaining_count: Optional. The number of remaining gifts of this type that can be sent; for limited gifts only
1127311273
:type remaining_count: :obj:`int`
1127411274

11275+
:param publisher_chat: Optional. Information about the chat that published the gift
11276+
:type publisher_chat: :class:`Chat`
11277+
1127511278
:return: Instance of the class
1127611279
:rtype: :class:`Gift`
1127711280
"""
1127811281

11279-
def __init__(self, id, sticker, star_count, total_count=None, remaining_count=None, upgrade_star_count=None, **kwargs):
11282+
def __init__(self, id, sticker, star_count, total_count=None, remaining_count=None, upgrade_star_count=None,
11283+
publisher_chat=None, **kwargs):
1128011284
self.id: str = id
1128111285
self.sticker: Sticker = sticker
1128211286
self.star_count: int = star_count
1128311287
self.total_count: Optional[int] = total_count
1128411288
self.remaining_count: Optional[int] = remaining_count
1128511289
self.upgrade_star_count: Optional[int] = upgrade_star_count
11290+
self.publisher_chat: Optional[Chat] = publisher_chat
1128611291

1128711292
@classmethod
1128811293
def de_json(cls, json_string):
1128911294
if json_string is None: return None
1129011295
obj = cls.check_json(json_string)
1129111296
obj['sticker'] = Sticker.de_json(obj['sticker'])
11297+
if 'publisher_chat' in obj:
11298+
obj['publisher_chat'] = Chat.de_json(obj['publisher_chat'])
1129211299
return cls(**obj)
1129311300

1129411301

@@ -11798,16 +11805,20 @@ class UniqueGift(JsonDeserializable):
1179811805
:param backdrop: Backdrop of the gift
1179911806
:type backdrop: :class:`UniqueGiftBackdrop`
1180011807

11808+
:param publisher_chat: Optional. Information about the chat that published the gift
11809+
:type publisher_chat: :class:`Chat`
11810+
1180111811
:return: Instance of the class
1180211812
:rtype: :class:`UniqueGift`
1180311813
"""
11804-
def __init__(self, base_name, name, number, model, symbol, backdrop, **kwargs):
11814+
def __init__(self, base_name, name, number, model, symbol, backdrop, publisher_chat=None, **kwargs):
1180511815
self.base_name: str = base_name
1180611816
self.name: str = name
1180711817
self.number: int = number
1180811818
self.model: UniqueGiftModel = model
1180911819
self.symbol: UniqueGiftSymbol = symbol
1181011820
self.backdrop: UniqueGiftBackdrop = backdrop
11821+
self.publisher_chat: Optional[Chat] = publisher_chat
1181111822

1181211823
@classmethod
1181311824
def de_json(cls, json_string):
@@ -11816,6 +11827,8 @@ def de_json(cls, json_string):
1181611827
obj['model'] = UniqueGiftModel.de_json(obj['model'])
1181711828
obj['symbol'] = UniqueGiftSymbol.de_json(obj['symbol'])
1181811829
obj['backdrop'] = UniqueGiftBackdrop.de_json(obj['backdrop'])
11830+
if 'publisher_chat' in obj:
11831+
obj['publisher_chat'] = Chat.de_json(obj['publisher_chat'])
1181911832
return cls(**obj)
1182011833

1182111834

0 commit comments

Comments
 (0)