From 850b79315f12445e9f03db324cbdf9ed8fe859c7 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 4 Apr 2020 23:47:09 +0200 Subject: [PATCH] Fix ttl_seconds not being parsed correctly --- pyrogram/client/types/messages_and_media/message.py | 2 +- pyrogram/client/types/messages_and_media/photo.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 451e8c25..7b99cbc5 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -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): diff --git a/pyrogram/client/types/messages_and_media/photo.py b/pyrogram/client/types/messages_and_media/photo.py index 1edfb4e2..235f4931 100644 --- a/pyrogram/client/types/messages_and_media/photo.py +++ b/pyrogram/client/types/messages_and_media/photo.py @@ -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),