Skip to content

Commit

Permalink
Fix ttl_seconds and thumbs not being optional
Browse files Browse the repository at this point in the history
  • Loading branch information
delivrance committed Apr 26, 2020
1 parent 5b042a6 commit 8c2dd9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions pyrogram/client/types/messages_and_media/photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -63,20 +63,20 @@ 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)

self.file_id = file_id
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
Expand All @@ -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
)
12 changes: 6 additions & 6 deletions pyrogram/client/types/messages_and_media/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
"""
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
)

0 comments on commit 8c2dd9d

Please sign in to comment.