From 8c2dd9d1c3ea219aa8d095e6b804cc1b13f25834 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 26 Apr 2020 12:21:10 +0200 Subject: [PATCH] Fix ttl_seconds and thumbs not being optional --- pyrogram/client/types/messages_and_media/photo.py | 14 +++++++------- pyrogram/client/types/messages_and_media/video.py | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pyrogram/client/types/messages_and_media/photo.py b/pyrogram/client/types/messages_and_media/photo.py index 235f49310b..36d37cacea 100644 --- a/pyrogram/client/types/messages_and_media/photo.py +++ b/pyrogram/client/types/messages_and_media/photo.py @@ -42,15 +42,15 @@ class Photo(Object): height (``int``): Photo height. - ttl_seconds (``int``): - Time-to-live seconds, for secret photos. - file_size (``int``): File size. date (``int``): Date the photo was sent in Unix time. + ttl_seconds (``int``, *optional*): + Time-to-live seconds, for secret photos. + thumbs (List of :obj:`Thumbnail`, *optional*): Available thumbnails of this photo. """ @@ -63,10 +63,10 @@ def __init__( file_ref: str, width: int, height: int, - ttl_seconds: int, file_size: int, date: int, - thumbs: List[Thumbnail] + ttl_seconds: int = None, + thumbs: List[Thumbnail] = None ): super().__init__(client) @@ -74,9 +74,9 @@ def __init__( self.file_ref = file_ref self.width = width self.height = height - self.ttl_seconds = ttl_seconds self.file_size = file_size self.date = date + self.ttl_seconds = ttl_seconds self.thumbs = thumbs @staticmethod @@ -96,9 +96,9 @@ def _parse(client, photo: types.Photo, ttl_seconds: int = None) -> "Photo": file_ref=encode_file_ref(photo.file_reference), width=big.w, height=big.h, - ttl_seconds=ttl_seconds, file_size=big.size, date=photo.date, + ttl_seconds=ttl_seconds, thumbs=Thumbnail._parse(client, photo), client=client ) diff --git a/pyrogram/client/types/messages_and_media/video.py b/pyrogram/client/types/messages_and_media/video.py index 92c8f46de6..16388b181c 100644 --- a/pyrogram/client/types/messages_and_media/video.py +++ b/pyrogram/client/types/messages_and_media/video.py @@ -51,9 +51,6 @@ 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. @@ -63,6 +60,9 @@ class Video(Object): date (``int``, *optional*): Date the video was sent in Unix time. + ttl_seconds (``int``. *optional*): + Time-to-live seconds, for secret photos. + thumbs (List of :obj:`Thumbnail`, *optional*): Video thumbnails. """ @@ -78,10 +78,10 @@ def __init__( 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, + ttl_seconds: int = None, thumbs: List[Thumbnail] = None ): super().__init__(client) @@ -93,10 +93,10 @@ def __init__( 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 + self.ttl_seconds = ttl_seconds self.thumbs = thumbs @staticmethod @@ -123,10 +123,10 @@ def _parse( 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, + ttl_seconds=ttl_seconds, thumbs=Thumbnail._parse(client, video), client=client )