From 72e150ca13b82733bda4b79cb7fd2d4720d65b1e Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 20 Apr 2020 22:40:39 +0200 Subject: [PATCH] Add ttl_seconds field to Video objects --- pyrogram/client/types/messages_and_media/message.py | 3 ++- pyrogram/client/types/messages_and_media/video.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 7b99cbc5..b03f097b 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -561,7 +561,8 @@ class Message(Object, Update): if video_attributes.round_message: video_note = pyrogram.VideoNote._parse(client, doc, video_attributes) else: - video = pyrogram.Video._parse(client, doc, video_attributes, file_name) + video = pyrogram.Video._parse(client, doc, video_attributes, file_name, + media.ttl_seconds) elif types.DocumentAttributeSticker in attributes: sticker = pyrogram.Sticker._parse( client, doc, diff --git a/pyrogram/client/types/messages_and_media/video.py b/pyrogram/client/types/messages_and_media/video.py index 59ce08bc..92c8f46d 100644 --- a/pyrogram/client/types/messages_and_media/video.py +++ b/pyrogram/client/types/messages_and_media/video.py @@ -51,6 +51,9 @@ class Video(Object): mime_type (``str``, *optional*): Mime type of a file as defined by sender. + ttl_seconds (``int``): + Time-to-live seconds, for secret photos. + supports_streaming (``bool``, *optional*): True, if the video was uploaded with streaming support. @@ -75,6 +78,7 @@ class Video(Object): duration: int, file_name: str = None, mime_type: str = None, + ttl_seconds: int = None, supports_streaming: bool = None, file_size: int = None, date: int = None, @@ -89,6 +93,7 @@ class Video(Object): self.duration = duration self.file_name = file_name self.mime_type = mime_type + self.ttl_seconds = ttl_seconds self.supports_streaming = supports_streaming self.file_size = file_size self.date = date @@ -99,7 +104,8 @@ class Video(Object): client, video: types.Document, video_attributes: types.DocumentAttributeVideo, - file_name: str + file_name: str, + ttl_seconds: int = None ) -> "Video": return Video( file_id=encode_file_id( @@ -117,6 +123,7 @@ class Video(Object): duration=video_attributes.duration, file_name=file_name, mime_type=video.mime_type, + ttl_seconds=ttl_seconds, supports_streaming=video_attributes.supports_streaming, file_size=video.size, date=video.date,