mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add stars field to class GiveawayLaunched
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
76deb77f1c
commit
f07d6563e3
2 changed files with 27 additions and 4 deletions
|
|
@ -16,13 +16,36 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
|
|
||||||
from ..object import Object
|
from ..object import Object
|
||||||
|
|
||||||
|
from pyrogram import raw
|
||||||
|
|
||||||
class GiveawayLaunched(Object):
|
class GiveawayLaunched(Object):
|
||||||
"""A service message about a giveaway started in the channel.
|
"""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):
|
def __init__(
|
||||||
super().__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
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -865,7 +865,7 @@ class Message(Object, Update):
|
||||||
gifted_premium = await types.GiftedPremium._parse(client, action, from_user.id)
|
gifted_premium = await types.GiftedPremium._parse(client, action, from_user.id)
|
||||||
service_type = enums.MessageServiceType.GIFTED_PREMIUM
|
service_type = enums.MessageServiceType.GIFTED_PREMIUM
|
||||||
elif isinstance(action, raw.types.MessageActionGiveawayLaunch):
|
elif isinstance(action, raw.types.MessageActionGiveawayLaunch):
|
||||||
giveaway_launched = types.GiveawayLaunched()
|
giveaway_launched = types.GiveawayLaunched._parse(client, action)
|
||||||
service_type = enums.MessageServiceType.GIVEAWAY_LAUNCHED
|
service_type = enums.MessageServiceType.GIVEAWAY_LAUNCHED
|
||||||
elif isinstance(action, raw.types.MessageActionGiveawayResults):
|
elif isinstance(action, raw.types.MessageActionGiveawayResults):
|
||||||
giveaway_result = await types.GiveawayResult._parse(client, action, True)
|
giveaway_result = await types.GiveawayResult._parse(client, action, True)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue