Add missing attributes to the Giveaway type

This commit is contained in:
KurimuzonAkuma 2023-12-25 21:57:51 +03:00
parent c14fc6fb26
commit 487a5ca47e

View File

@ -41,11 +41,18 @@ class Giveaway(Object):
until_date (:py:obj:`~datetime.datetime`):
Date when the giveaway will end.
only_new_subscribers (``bool``):
description (``str``, *optional*):
Prize description.
only_new_subscribers (``bool``, *optional*):
True if the giveaway is for new subscribers only.
only_for_countries (List of ``str`` , *optional*):
Countries for which the giveaway is available in iso2 format.
winners_are_visible (``bool``, *optional*):
True if the winners is visible.
"""
def __init__(
@ -56,9 +63,10 @@ class Giveaway(Object):
quantity: int = None,
months: int = None,
until_date: datetime = None,
description: str = None,
only_new_subscribers: bool = None,
only_for_countries: List[str] = None
only_for_countries: List[str] = None,
winners_are_visible: bool = None
):
super().__init__(client)
@ -66,8 +74,10 @@ class Giveaway(Object):
self.quantity = quantity
self.months = months
self.until_date = until_date
self.description = description
self.only_new_subscribers = only_new_subscribers
self.only_for_countries = only_for_countries
self.winners_are_visible = winners_are_visible
@staticmethod
def _parse(
@ -80,7 +90,9 @@ class Giveaway(Object):
quantity=giveaway.quantity,
months=giveaway.months,
until_date=utils.timestamp_to_datetime(giveaway.until_date),
only_new_subscribers=giveaway.only_new_subscribers,
only_for_countries=types.List(giveaway.countries_iso2) or None,
description=getattr(giveaway, "prize_description", None) or None,
only_new_subscribers=getattr(giveaway, "only_new_subscribers", None),
only_for_countries=types.List(getattr(giveaway, "countries_iso2", [])) or None,
winners_are_visible=getattr(giveaway, "winners_are_visible", None),
client=client
)