Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bot API 7.10 #2395

Merged
merged 7 commits into from
Sep 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions telebot/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8994,6 +8994,9 @@ class Giveaway(JsonDeserializable):
:param country_codes: Optional. A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway.
:type country_codes: :obj:`list` of :obj:`str`

:param prize_star_count: Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
:type prize_star_count: :obj:`int`

:param premium_subscription_month_count: Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for
:type premium_subscription_month_count: :obj:`int`

Expand All @@ -9011,7 +9014,7 @@ def de_json(cls, json_string):
def __init__(self, chats: List[Chat], winners_selection_date: int, winner_count: int,
only_new_members: Optional[bool] = None, has_public_winners: Optional[bool] = None,
prize_description: Optional[str] = None, country_codes: Optional[List[str]] = None,
premium_subscription_month_count: Optional[int] = None, **kwargs) -> None:
premium_subscription_month_count: Optional[int] = None, prize_star_count: Optional[int] = None, **kwargs) -> None:
self.chats: List[Chat] = chats
self.winners_selection_date: int = winners_selection_date
self.winner_count: int = winner_count
Expand All @@ -9020,6 +9023,7 @@ def __init__(self, chats: List[Chat], winners_selection_date: int, winner_count:
self.prize_description: Optional[str] = prize_description
self.country_codes: Optional[List[str]] = country_codes
self.premium_subscription_month_count: Optional[int] = premium_subscription_month_count
self.prize_star_count: Optional[int] = prize_star_count


class GiveawayWinners(JsonDeserializable):
Expand Down Expand Up @@ -9061,6 +9065,9 @@ class GiveawayWinners(JsonDeserializable):
:param prize_description: Optional. Description of additional giveaway prize
:type prize_description: :obj:`str`

:param prize_star_count: Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
:type prize_star_count: :obj:`int`

:return: Instance of the class
:rtype: :class:`GiveawayWinners`
"""
Expand All @@ -9077,7 +9084,7 @@ def __init__(self, chat: Chat, giveaway_message_id: int, winners_selection_date:
winners: List[User], additional_chat_count: Optional[int] = None,
premium_subscription_month_count: Optional[int] = None, unclaimed_prize_count: Optional[int] = None,
only_new_members: Optional[bool] = None, was_refunded: Optional[bool] = None,
prize_description: Optional[str] = None, **kwargs) -> None:
prize_description: Optional[str] = None, prize_star_count: Optional[int] = None, **kwargs) -> None:
self.chat: Chat = chat
self.giveaway_message_id: int = giveaway_message_id
self.winners_selection_date: int = winners_selection_date
Expand All @@ -9089,6 +9096,7 @@ def __init__(self, chat: Chat, giveaway_message_id: int, winners_selection_date:
self.only_new_members: Optional[bool] = only_new_members
self.was_refunded: Optional[bool] = was_refunded
self.prize_description: Optional[str] = prize_description
self.prize_star_count: Optional[int] = prize_star_count


class GiveawayCompleted(JsonDeserializable):
Expand All @@ -9106,6 +9114,9 @@ class GiveawayCompleted(JsonDeserializable):
:param giveaway_message: Optional. Message with the giveaway that was completed, if it wasn't deleted
:type giveaway_message: :class:`Message`

:param is_star_giveaway: Optional. True, if the giveaway was a Telegram Star giveaway
:type is_star_giveaway: :obj:`bool`

:return: Instance of the class
:rtype: :class:`GiveawayCompleted`
"""
Expand All @@ -9119,15 +9130,21 @@ def de_json(cls, json_string):
return cls(**obj)

def __init__(self, winner_count: int, unclaimed_prize_count: Optional[int] = None,
giveaway_message: Optional[Message] = None, **kwargs) -> None:
giveaway_message: Optional[Message] = None, is_star_giveaway: Optional[bool] = None, **kwargs) -> None:
self.winner_count: int = winner_count
self.unclaimed_prize_count: Optional[int] = unclaimed_prize_count
self.giveaway_message: Optional[Message] = giveaway_message
self.is_star_giveaway: Optional[bool] = is_star_giveaway


class GiveawayCreated(JsonDeserializable):
"""
This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
This object represents a service message about the creation of a scheduled giveaway.

:prize_star_count: Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
:type prize_star_count: :obj:`int`

:return: Instance of the class
"""

@classmethod
Expand All @@ -9136,8 +9153,8 @@ def de_json(cls, json_string):
obj = cls.check_json(json_string)
return cls(**obj)

def __init__(self, **kwargs) -> None:
pass
def __init__(self, prize_star_count=None, **kwargs) -> None:
self.prize_star_count: Optional[str] = prize_star_count


class TextQuote(JsonDeserializable):
Expand Down Expand Up @@ -9468,6 +9485,9 @@ class ChatBoostSourceGiveaway(ChatBoostSource):
:param is_unclaimed: True, if the giveaway was completed, but there was no user to win the prize
:type is_unclaimed: :obj:`bool`

:param prize_star_count: Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
:type prize_star_count: :obj:`int`

:return: Instance of the class
:rtype: :class:`ChatBoostSourceGiveaway`
"""
Expand All @@ -9479,11 +9499,12 @@ def de_json(cls, json_string):
obj['user'] = User.de_json(obj.get('user'))
return cls(**obj)

def __init__(self, source, giveaway_message_id, user=None, is_unclaimed=None, **kwargs):
def __init__(self, source, giveaway_message_id, user=None, is_unclaimed=None, prize_star_count=None, **kwargs):
self.source: str = source
self.giveaway_message_id: int = giveaway_message_id
self.user: User = user
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user should be Optional

self.is_unclaimed: bool = is_unclaimed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_unclaimed should be Optional

self.prize_star_count: Optional[int] = prize_star_count


class ChatBoost(JsonDeserializable):
Expand Down