diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index a4a541638..5d17da735 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -239,6 +239,12 @@ class Message(Object, Update): video (:obj:`~pyrogram.types.Video`, *optional*): Message is a video, information about the video. + video_processing_pending (``bool``, *optional*): + True, if the video is still processing. + + alternative_videos (List of :obj:`~pyrogram.types.Video`, *optional*): + Alternative qualities of the video, if the message is a video. + voice (:obj:`~pyrogram.types.Voice`, *optional*): Message is a voice message, information about the file. @@ -506,6 +512,8 @@ def __init__( invoice: "types.MessageInvoice" = None, story: Union["types.MessageStory", "types.Story"] = None, video: "types.Video" = None, + video_processing_pending: bool = None, + alternative_videos: List["types.Video"] = None, voice: "types.Voice" = None, video_note: "types.VideoNote" = None, web_page_preview: "types.WebPagePreview" = None, @@ -624,6 +632,8 @@ def __init__( self.invoice = invoice self.story = story self.video = video + self.video_processing_pending = video_processing_pending + self.alternative_videos = alternative_videos self.voice = voice self.video_note = video_note self.web_page_preview = web_page_preview @@ -1127,6 +1137,7 @@ async def _parse( voice = None animation = None video = None + alternative_videos = [] video_note = None web_page_preview = None sticker = None @@ -1203,15 +1214,28 @@ async def _parse( ) media_type = enums.MessageMediaType.VIDEO_NOTE else: - video = types.Video._parse( - client, - doc, - video_attributes, - file_name, - media.ttl_seconds, - ) + video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds) media_type = enums.MessageMediaType.VIDEO has_media_spoiler = media.spoiler + + altdocs = media.alt_documents or [] + for altdoc in altdocs: + if isinstance(altdoc, raw.types.Document): + altdoc_attributes = {type(i): i for i in altdoc.attributes} + altdoc_file_name = getattr( + altdoc_attributes.get( + raw.types.DocumentAttributeFilename, None + ), "file_name", None + ) + + altdoc_video_attribute = altdoc_attributes.get(raw.types.DocumentAttributeVideo, + None) + + if altdoc_video_attribute: + alternative_videos.append( + types.Video._parse(client, altdoc, altdoc_video_attribute, + altdoc_file_name) + ) elif raw.types.DocumentAttributeAudio in attributes: audio_attributes = attributes[ raw.types.DocumentAttributeAudio @@ -1344,6 +1368,12 @@ async def _parse( invoice=invoice, story=story, video=video, + video_processing_pending=getattr( + message, "video_processing_pending", None + ), + alternative_videos=( + types.List(alternative_videos) if alternative_videos else None + ), video_note=video_note, web_page_preview=web_page_preview, sticker=sticker,