Fix ttl_seconds not being parsed correctly

This commit is contained in:
Dan 2020-04-04 23:47:09 +02:00
parent fa157b59f1
commit 850b79315f
2 changed files with 3 additions and 5 deletions

View File

@ -523,7 +523,7 @@ class Message(Object, Update):
if media:
if isinstance(media, types.MessageMediaPhoto):
photo = Photo._parse(client, media)
photo = Photo._parse(client, media.photo, media.ttl_seconds)
elif isinstance(media, types.MessageMediaGeo):
location = Location._parse(client, media.geo)
elif isinstance(media, types.MessageMediaContact):

View File

@ -80,9 +80,7 @@ class Photo(Object):
self.thumbs = thumbs
@staticmethod
def _parse(client, media_photo: types.MessageMediaPhoto) -> "Photo":
photo = media_photo.photo
def _parse(client, photo: types.Photo, ttl_seconds: int = None) -> "Photo":
if isinstance(photo, types.Photo):
big = photo.sizes[-1]
@ -98,7 +96,7 @@ class Photo(Object):
file_ref=encode_file_ref(photo.file_reference),
width=big.w,
height=big.h,
ttl_seconds=media_photo.ttl_seconds,
ttl_seconds=ttl_seconds,
file_size=big.size,
date=photo.date,
thumbs=Thumbnail._parse(client, photo),