diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index b94fc69c..fbfca35f 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -464,6 +464,7 @@ def pyrogram_api(): StickerSet Game Giveaway + GiveawayLaunched GiveawayResult MessageStory WebPage diff --git a/pyrogram/enums/message_service_type.py b/pyrogram/enums/message_service_type.py index a61edeb9..fe7cf324 100644 --- a/pyrogram/enums/message_service_type.py +++ b/pyrogram/enums/message_service_type.py @@ -100,5 +100,8 @@ class MessageServiceType(AutoName): WEB_APP_DATA = auto() "Web app data" + GIVEAWAY_LAUNCHED = auto() + "Giveaway Launch" + GIVEAWAY_RESULT = auto() "Giveaway Result" diff --git a/pyrogram/types/messages_and_media/__init__.py b/pyrogram/types/messages_and_media/__init__.py index 6e48724e..a5851868 100644 --- a/pyrogram/types/messages_and_media/__init__.py +++ b/pyrogram/types/messages_and_media/__init__.py @@ -23,6 +23,7 @@ from .dice import Dice from .document import Document from .game import Game from .giveaway import Giveaway +from .giveaway_launched import GiveawayLaunched from .giveaway_result import GiveawayResult from .location import Location from .media_area import MediaArea @@ -57,7 +58,7 @@ from .story_views import StoryViews from .exported_story_link import ExportedStoryLink __all__ = [ - "Animation", "Audio", "Contact", "Document", "Game", "Giveaway", "GiveawayResult", "Location", "MediaArea", "MediaAreaChannelPost", "MediaAreaCoordinates", "Message", "MessageEntity", "Photo", "Thumbnail", + "Animation", "Audio", "Contact", "Document", "Game", "Giveaway", "GiveawayLaunched", "GiveawayResult", "Location", "MediaArea", "MediaAreaChannelPost", "MediaAreaCoordinates", "Message", "MessageEntity", "Photo", "Thumbnail", "StrippedThumbnail", "Poll", "PollOption", "Sticker", "StickerSet", "Venue", "Video", "VideoNote", "Voice", "WebPage", "WebPageEmpty", "WebPagePreview", "Dice", "Reaction", "WebAppData", "MessageReactions", "MessageStory", "Story", "StoryDeleted", "StorySkipped", "StoryViews", "StoryForwardHeader", "StoriesPrivacyRules", "ExportedStoryLink" ] diff --git a/pyrogram/types/messages_and_media/giveaway_launched.py b/pyrogram/types/messages_and_media/giveaway_launched.py new file mode 100644 index 00000000..68d0c3d7 --- /dev/null +++ b/pyrogram/types/messages_and_media/giveaway_launched.py @@ -0,0 +1,28 @@ +# Pyrofork - Telegram MTProto API Client Library for Python +# Copyright (C) 2022-present Mayuri-Chan +# +# This file is part of Pyrofork. +# +# Pyrofork is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pyrofork is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrofork. If not, see . + +from ..object import Object + +class GiveawayLaunched(Object): + """A service message about a giveaway started in the channel. + + Currently holds no information. + """ + + def __init__(self): + super().__init__() diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 64c62bf4..f6c49e2f 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -340,6 +340,9 @@ class Message(Object, Update): general_topic_unhidden (:obj:`~pyrogram.types.GeneralTopicUnhidden`, *optional*): Service message: forum general topic unhidden + giveaway_launcheded (:obj:`~pyrogram.types.GiveawayLaunched`, *optional*): + Service message: giveaway launched. + video_chat_scheduled (:obj:`~pyrogram.types.VideoChatScheduled`, *optional*): Service message: voice chat scheduled. @@ -453,6 +456,7 @@ class Message(Object, Update): forum_topic_edited: "types.ForumTopicEdited" = None, general_topic_hidden: "types.GeneralTopicHidden" = None, general_topic_unhidden: "types.GeneralTopicUnhidden" = None, + giveaway_launched: "types.GiveawayLauncheded" = None, video_chat_scheduled: "types.VideoChatScheduled" = None, video_chat_started: "types.VideoChatStarted" = None, video_chat_ended: "types.VideoChatEnded" = None, @@ -550,6 +554,7 @@ class Message(Object, Update): self.forum_topic_edited = forum_topic_edited self.general_topic_hidden = general_topic_hidden self.general_topic_unhidden = general_topic_unhidden + self.giveaway_launched = giveaway_launched self.video_chat_scheduled = video_chat_scheduled self.video_chat_started = video_chat_started self.video_chat_ended = video_chat_ended @@ -655,6 +660,7 @@ class Message(Object, Update): video_chat_ended = None video_chat_members_invited = None web_app_data = None + giveaway_launched = None giveaway_result = None service_type = None @@ -738,6 +744,9 @@ class Message(Object, Update): elif isinstance(action, raw.types.MessageActionWebViewDataSentMe): web_app_data = types.WebAppData._parse(action) service_type = enums.MessageServiceType.WEB_APP_DATA + elif isinstance(action, raw.types.MessageActionGiveawayLaunch): + giveaway_launched = types.GiveawayLaunched() + service_type = enums.MessageServiceType.GIVEAWAY_LAUNCHED elif isinstance(action, raw.types.MessageActionGiveawayResults): giveaway_result = await types.GiveawayResult._parse(client, action, True) service_type = enums.MessageServiceType.GIVEAWAY_RESULT @@ -777,6 +786,7 @@ class Message(Object, Update): video_chat_ended=video_chat_ended, video_chat_members_invited=video_chat_members_invited, web_app_data=web_app_data, + giveaway_launched=giveaway_launched, giveaway_result=giveaway_result, client=client # TODO: supergroup_chat_created