mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 07:24: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*):
|
months (``int``, *optional*):
|
||||||
How long the telegram premium last (in month).
|
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*):
|
expire_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||||
Date the giveaway winner(s) choosen.
|
Date the giveaway winner(s) choosen.
|
||||||
|
|
||||||
|
|
@ -55,6 +58,9 @@ class GiveawayResult(Object):
|
||||||
is_refunded (``bool``, *optional*):
|
is_refunded (``bool``, *optional*):
|
||||||
True, if the giveaway was refunded.
|
True, if the giveaway was refunded.
|
||||||
|
|
||||||
|
is_star_giveaway (``bool``, *optional*):
|
||||||
|
True, if the giveaway is a star giveaway.
|
||||||
|
|
||||||
is_winners_hidden (``bool``):
|
is_winners_hidden (``bool``):
|
||||||
True, if the giveaway winners are hidden.
|
True, if the giveaway winners are hidden.
|
||||||
"""
|
"""
|
||||||
|
|
@ -69,9 +75,11 @@ class GiveawayResult(Object):
|
||||||
unclaimed_quantity: int,
|
unclaimed_quantity: int,
|
||||||
winners: List["types.User"] = None,
|
winners: List["types.User"] = None,
|
||||||
months: int = None,
|
months: int = None,
|
||||||
|
stars: int = None,
|
||||||
expire_date: datetime = None,
|
expire_date: datetime = None,
|
||||||
new_subscribers : bool = None,
|
new_subscribers : bool = None,
|
||||||
is_refunded: bool = None,
|
is_refunded: bool = None,
|
||||||
|
is_star_giveaway: bool = None,
|
||||||
is_winners_hidden: bool
|
is_winners_hidden: bool
|
||||||
):
|
):
|
||||||
super().__init__(client)
|
super().__init__(client)
|
||||||
|
|
@ -82,9 +90,11 @@ class GiveawayResult(Object):
|
||||||
self.unclaimed_quantity = unclaimed_quantity
|
self.unclaimed_quantity = unclaimed_quantity
|
||||||
self.winners = winners
|
self.winners = winners
|
||||||
self.months = months
|
self.months = months
|
||||||
|
self.stars = stars
|
||||||
self.expire_date = expire_date
|
self.expire_date = expire_date
|
||||||
self.new_subscribers = new_subscribers
|
self.new_subscribers = new_subscribers
|
||||||
self.is_refunded = is_refunded
|
self.is_refunded = is_refunded
|
||||||
|
self.is_star_giveaway = is_star_giveaway
|
||||||
self.is_winners_hidden = is_winners_hidden
|
self.is_winners_hidden = is_winners_hidden
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
@ -114,6 +124,8 @@ class GiveawayResult(Object):
|
||||||
for winner in giveaway_result.winners:
|
for winner in giveaway_result.winners:
|
||||||
winners.append(await client.get_users(winner))
|
winners.append(await client.get_users(winner))
|
||||||
|
|
||||||
|
stars = getattr(giveaway_result, "stars", None)
|
||||||
|
|
||||||
return GiveawayResult(
|
return GiveawayResult(
|
||||||
chat=chat,
|
chat=chat,
|
||||||
giveaway_message=giveaway_message,
|
giveaway_message=giveaway_message,
|
||||||
|
|
@ -121,9 +133,11 @@ class GiveawayResult(Object):
|
||||||
unclaimed_quantity=getattr(giveaway_result, "unclaimed_count", None),
|
unclaimed_quantity=getattr(giveaway_result, "unclaimed_count", None),
|
||||||
winners=winners,
|
winners=winners,
|
||||||
months=getattr(giveaway_result, "months", None),
|
months=getattr(giveaway_result, "months", None),
|
||||||
|
stars=stars if isinstance(giveaway_result, raw.types.MessageMediaGiveawayResults) else None,
|
||||||
expire_date=expired_date,
|
expire_date=expired_date,
|
||||||
new_subscribers=getattr(giveaway_result, "only_new_subscribers", None),
|
new_subscribers=getattr(giveaway_result, "only_new_subscribers", None),
|
||||||
is_refunded=getattr(giveaway_result, "refunded", None),
|
is_refunded=getattr(giveaway_result, "refunded", None),
|
||||||
|
is_star_giveaway=bool(stars),
|
||||||
is_winners_hidden=hide_winners,
|
is_winners_hidden=hide_winners,
|
||||||
client=client
|
client=client
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue