Skip to content

Commit 8d61448

Browse files
Added the field unique_gift_variant_count to the class Gift. Added the field unique_gift_number to the classes GiftInfo and OwnedGiftRegular.
1 parent 8ad7d7e commit 8d61448

1 file changed

Lines changed: 33 additions & 14 deletions

File tree

telebot/types.py

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11382,6 +11382,10 @@ class Gift(JsonDeserializable):
1138211382

1138311383
:param background: Optional. Background of the gift
1138411384
:type background: :class:`GiftBackground`
11385+
11386+
:param unique_gift_variant_count: Optional. The total number of different unique gifts that can be obtained by upgrading the gift
11387+
:type unique_gift_variant_count: :obj:`int`
11388+
1138511389
:param publisher_chat: Optional. Information about the chat that published the gift
1138611390
:type publisher_chat: :class:`Chat`
1138711391

@@ -11391,7 +11395,7 @@ class Gift(JsonDeserializable):
1139111395

1139211396
def __init__(self, id, sticker, star_count, total_count=None, remaining_count=None, upgrade_star_count=None,
1139311397
personal_total_count=None, personal_remaining_count=None, is_premium=None, has_colors=None,
11394-
background=None, publisher_chat=None, **kwargs):
11398+
background=None, publisher_chat=None, unique_gift_variant_count=None, **kwargs):
1139511399
self.id: str = id
1139611400
self.sticker: Sticker = sticker
1139711401
self.star_count: int = star_count
@@ -11404,6 +11408,7 @@ def __init__(self, id, sticker, star_count, total_count=None, remaining_count=No
1140411408
self.has_colors: Optional[bool] = has_colors
1140511409
self.background: Optional[GiftBackground] = background
1140611410
self.publisher_chat: Optional[Chat] = publisher_chat
11411+
self.unique_gift_variant_count: Optional[int] = unique_gift_variant_count
1140711412

1140811413
@classmethod
1140911414
def de_json(cls, json_string):
@@ -11649,26 +11654,35 @@ class AcceptedGiftTypes(JsonDeserializable, JsonSerializable):
1164911654
:param premium_subscription: True, if a Telegram Premium subscription is accepted
1165011655
:type premium_subscription: :obj:`bool`
1165111656

11657+
:param gifts_from_channels: True, if transfers of unique gifts from channels are accepted
11658+
:type gifts_from_channels: :obj:`bool`
11659+
1165211660
:return: Instance of the class
1165311661
:rtype: :class:`AcceptedGiftTypes`
1165411662
"""
11655-
def __init__(self, unlimited_gifts: bool, limited_gifts: bool,
11656-
unique_gifts: bool, premium_subscription: bool, **kwargs):
11657-
self.unlimited_gifts: bool = unlimited_gifts
11658-
self.limited_gifts: bool = limited_gifts
11659-
self.unique_gifts: bool = unique_gifts
11660-
self.premium_subscription: bool = premium_subscription
11663+
def __init__(self, unlimited_gifts: Optional[bool]=None, limited_gifts: Optional[bool]=None,
11664+
unique_gifts: Optional[bool]=None, premium_subscription: Optional[bool]=None, gifts_from_channels: Optional[bool]=None, **kwargs):
11665+
self.unlimited_gifts: Optional[bool] = unlimited_gifts
11666+
self.limited_gifts: Optional[bool] = limited_gifts
11667+
self.unique_gifts: Optional[bool] = unique_gifts
11668+
self.premium_subscription: Optional[bool] = premium_subscription
11669+
self.gifts_from_channels: Optional[bool] = gifts_from_channels
1166111670

1166211671
def to_json(self):
1166311672
return json.dumps(self.to_dict())
1166411673

1166511674
def to_dict(self):
11666-
data = {
11667-
'unlimited_gifts': self.unlimited_gifts,
11668-
'limited_gifts': self.limited_gifts,
11669-
'unique_gifts': self.unique_gifts,
11670-
'premium_subscription': self.premium_subscription
11671-
}
11675+
data = {}
11676+
if self.unlimited_gifts is not None:
11677+
data['unlimited_gifts'] = self.unlimited_gifts
11678+
if self.limited_gifts is not None:
11679+
data['limited_gifts'] = self.limited_gifts
11680+
if self.unique_gifts is not None:
11681+
data['unique_gifts'] = self.unique_gifts
11682+
if self.premium_subscription is not None:
11683+
data['premium_subscription'] = self.premium_subscription
11684+
if self.gifts_from_channels is not None:
11685+
data['gifts_from_channels'] = self.gifts_from_channels
1167211686
return data
1167311687

1167411688
@classmethod
@@ -12562,13 +12576,17 @@ class GiftInfo(JsonDeserializable):
1256212576
:param is_private: Optional. True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them
1256312577
:type is_private: :obj:`bool`
1256412578

12579+
:param unique_gift_number: Optional. Unique number reserved for this gift when upgraded. See the number field in UniqueGift
12580+
:type unique_gift_number: :obj:`int`
12581+
1256512582
:return: Instance of the class
1256612583
:rtype: :class:`GiftInfo`
1256712584
"""
1256812585
def __init__(self, gift: Gift, owned_gift_id: Optional[str] = None, convert_star_count: Optional[int] = None,
1256912586
prepaid_upgrade_star_count: Optional[int] = None, can_be_upgraded: Optional[bool] = None,
1257012587
text: Optional[str] = None, entities: Optional[List[MessageEntity]] = None,
12571-
is_private: Optional[bool] = None, is_upgrade_separate: Optional[bool] = None, **kwargs):
12588+
is_private: Optional[bool] = None, is_upgrade_separate: Optional[bool] = None,
12589+
unique_gift_number: Optional[int] = None, **kwargs):
1257212590
self.gift: Gift = gift
1257312591
self.owned_gift_id: Optional[str] = owned_gift_id
1257412592
self.convert_star_count: Optional[int] = convert_star_count
@@ -12578,6 +12596,7 @@ def __init__(self, gift: Gift, owned_gift_id: Optional[str] = None, convert_star
1257812596
self.entities: Optional[List[MessageEntity]] = entities
1257912597
self.is_private: Optional[bool] = is_private
1258012598
self.is_upgrade_separate: Optional[bool] = is_upgrade_separate
12599+
self.unique_gift_number: Optional[int] = unique_gift_number
1258112600

1258212601
@classmethod
1258312602
def de_json(cls, json_string):

0 commit comments

Comments
 (0)