mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
pyrofork: Add stars and is_star_giveaway field to class GiveawayResult
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
2faae08064
commit
02eed79861
1 changed files with 14 additions and 0 deletions
|
|
@ -46,6 +46,9 @@ class GiveawayResult(Object):
|
|||
months (``int``, *optional*):
|
||||
How long the telegram premium last (in month).
|
||||
|
||||
stars (``int``, *optional*):
|
||||
How many stars the giveaway winner(s) get.
|
||||
|
||||
expire_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date the giveaway winner(s) choosen.
|
||||
|
||||
|
|
@ -55,6 +58,9 @@ class GiveawayResult(Object):
|
|||
is_refunded (``bool``, *optional*):
|
||||
True, if the giveaway was refunded.
|
||||
|
||||
is_star_giveaway (``bool``, *optional*):
|
||||
True, if the giveaway is a star giveaway.
|
||||
|
||||
is_winners_hidden (``bool``):
|
||||
True, if the giveaway winners are hidden.
|
||||
"""
|
||||
|
|
@ -69,9 +75,11 @@ class GiveawayResult(Object):
|
|||
unclaimed_quantity: int,
|
||||
winners: List["types.User"] = None,
|
||||
months: int = None,
|
||||
stars: int = None,
|
||||
expire_date: datetime = None,
|
||||
new_subscribers : bool = None,
|
||||
is_refunded: bool = None,
|
||||
is_star_giveaway: bool = None,
|
||||
is_winners_hidden: bool
|
||||
):
|
||||
super().__init__(client)
|
||||
|
|
@ -82,9 +90,11 @@ class GiveawayResult(Object):
|
|||
self.unclaimed_quantity = unclaimed_quantity
|
||||
self.winners = winners
|
||||
self.months = months
|
||||
self.stars = stars
|
||||
self.expire_date = expire_date
|
||||
self.new_subscribers = new_subscribers
|
||||
self.is_refunded = is_refunded
|
||||
self.is_star_giveaway = is_star_giveaway
|
||||
self.is_winners_hidden = is_winners_hidden
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -113,6 +123,8 @@ class GiveawayResult(Object):
|
|||
winners = []
|
||||
for winner in giveaway_result.winners:
|
||||
winners.append(await client.get_users(winner))
|
||||
|
||||
stars = getattr(giveaway_result, "stars", None)
|
||||
|
||||
return GiveawayResult(
|
||||
chat=chat,
|
||||
|
|
@ -121,9 +133,11 @@ class GiveawayResult(Object):
|
|||
unclaimed_quantity=getattr(giveaway_result, "unclaimed_count", None),
|
||||
winners=winners,
|
||||
months=getattr(giveaway_result, "months", None),
|
||||
stars=stars if isinstance(giveaway_result, raw.types.MessageMediaGiveawayResults) else None,
|
||||
expire_date=expired_date,
|
||||
new_subscribers=getattr(giveaway_result, "only_new_subscribers", None),
|
||||
is_refunded=getattr(giveaway_result, "refunded", None),
|
||||
is_star_giveaway=bool(stars),
|
||||
is_winners_hidden=hide_winners,
|
||||
client=client
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue