Skip to content

Commit

Permalink
pyrofork: remove sticker field from GiftedPremium
Browse files Browse the repository at this point in the history
not exist in raw types

Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
wulan17 committed Jun 15, 2024
1 parent a7db65b commit d8e038b
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions pyrogram/types/messages_and_media/gifted_premium.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ class GiftedPremium(Object):
month_count (``int``):
Number of months the Telegram Premium subscription will be active
sticker (:obj:`~pyrogram.types.Sticker`):
A sticker to be shown in the message; may be null if unknown
"""

def __init__(
Expand All @@ -58,8 +54,7 @@ def __init__(
amount: int = None,
cryptocurrency: str = None,
cryptocurrency_amount: int = None,
month_count: int = None,
sticker: "types.Sticker" = None,
month_count: int = None
):
super().__init__()

Expand All @@ -69,25 +64,18 @@ def __init__(
self.cryptocurrency = cryptocurrency
self.cryptocurrency_amount = cryptocurrency_amount
self.month_count = month_count
self.sticker = sticker

@staticmethod
async def _parse(
client,
gifted_premium: "raw.types.MessageActionGiftPremium",
gifter_user_id: int
) -> "GiftedPremium":
sticker = None
stickers, _ = await client._get_raw_stickers(
raw.types.InputStickerSetPremiumGifts()
)
sticker = choice(stickers)
return GiftedPremium(
gifter_user_id=gifter_user_id,
currency=gifted_premium.currency,
amount=gifted_premium.amount,
cryptocurrency=getattr(gifted_premium, "crypto_currency", None),
cryptocurrency_amount=getattr(gifted_premium, "crypto_amount", None),
month_count=gifted_premium.months,
sticker=sticker
month_count=gifted_premium.months
)

0 comments on commit d8e038b

Please sign in to comment.