1919from random import choice
2020from typing import Optional
2121
22- from pyrogram import raw , types
22+ from pyrogram import raw , types , utils
2323from ..object import Object
2424from .message import Str
2525
@@ -44,7 +44,10 @@ class GiftedPremium(Object):
4444 The paid amount, in the smallest units of the cryptocurrency; 0 if none
4545
4646 month_count (``int``):
47- Number of months the Telegram Premium subscription will be active
47+ Number of months the Telegram Premium subscription will be active.
48+
49+ day_count (``int``):
50+ Number of days the Telegram Premium subscription will be active.
4851
4952 sticker (:obj:`~pyrogram.types.Sticker`):
5053 A sticker to be shown in the transaction information; may be None if unknown
@@ -66,6 +69,7 @@ def __init__(
6669 cryptocurrency : Optional [str ] = None ,
6770 cryptocurrency_amount : Optional [int ] = None ,
6871 month_count : Optional [int ] = None ,
72+ day_count : Optional [int ] = None ,
6973 sticker : Optional ["types.Sticker" ] = None ,
7074 caption : Optional [Str ] = None ,
7175 caption_entities : Optional [list ["types.MessageEntity" ]] = None
@@ -78,6 +82,7 @@ def __init__(
7882 self .cryptocurrency = cryptocurrency
7983 self .cryptocurrency_amount = cryptocurrency_amount
8084 self .month_count = month_count
85+ self .day_count = day_count
8186 self .sticker = sticker
8287 self .caption = caption
8388 self .caption_entities = caption_entities
@@ -110,8 +115,9 @@ async def _parse(
110115 amount = gifted_premium .amount ,
111116 cryptocurrency = getattr (gifted_premium , "crypto_currency" , None ),
112117 cryptocurrency_amount = getattr (gifted_premium , "crypto_amount" , None ),
113- month_count = gifted_premium .months ,
118+ day_count = gifted_premium .days ,
119+ month_count = utils .get_premium_duration_month_count (gifted_premium .days ),
114120 sticker = sticker ,
115121 caption = caption ,
116- caption_entities = caption_entities
122+ caption_entities = caption_entities or None
117123 )
0 commit comments