pyrofork: Add stars field to class GiveawayLaunched

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2024-09-07 16:29:22 +07:00
parent 76deb77f1c
commit f07d6563e3
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
2 changed files with 27 additions and 4 deletions

View file

@ -16,13 +16,36 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from ..object import Object
from pyrogram import raw
class GiveawayLaunched(Object):
"""A service message about a giveaway started in the channel.
Currently holds no information.
Parameters:
stars (``int``, *optional*):
How many stars the giveaway winner(s) get.
"""
def __init__(self):
super().__init__()
def __init__(
self,
*,
client: "pyrogram.Client" = None,
stars: int = None
):
super().__init__(client)
self.stars = stars
@staticmethod
def _parse(
client: "pyrogram.Client",
giveaway_launched: "raw.types.MessageActionGiveawayLaunch"
) -> "GiveawayLaunched":
return GiveawayLaunched(
client=client,
stars=giveaway_launched.stars
)

View file

@ -865,7 +865,7 @@ class Message(Object, Update):
gifted_premium = await types.GiftedPremium._parse(client, action, from_user.id)
service_type = enums.MessageServiceType.GIFTED_PREMIUM
elif isinstance(action, raw.types.MessageActionGiveawayLaunch):
giveaway_launched = types.GiveawayLaunched()
giveaway_launched = types.GiveawayLaunched._parse(client, action)
service_type = enums.MessageServiceType.GIVEAWAY_LAUNCHED
elif isinstance(action, raw.types.MessageActionGiveawayResults):
giveaway_result = await types.GiveawayResult._parse(client, action, True)