From 487a5ca47e08140a17ed6dc58de4edcc53aced43 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Mon, 25 Dec 2023 21:57:51 +0300 Subject: [PATCH] Add missing attributes to the Giveaway type --- pyrogram/types/messages_and_media/giveaway.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pyrogram/types/messages_and_media/giveaway.py b/pyrogram/types/messages_and_media/giveaway.py index e6ae961e..b82a8dc0 100644 --- a/pyrogram/types/messages_and_media/giveaway.py +++ b/pyrogram/types/messages_and_media/giveaway.py @@ -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 )