mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-05 06:44:51 +00:00
Add ttl_seconds to Photo objects
This commit is contained in:
parent
945effc4a9
commit
a54cd2e4fc
2 changed files with 10 additions and 2 deletions
|
|
@ -523,7 +523,7 @@ class Message(Object, Update):
|
||||||
|
|
||||||
if media:
|
if media:
|
||||||
if isinstance(media, types.MessageMediaPhoto):
|
if isinstance(media, types.MessageMediaPhoto):
|
||||||
photo = Photo._parse(client, media.photo)
|
photo = Photo._parse(client, media)
|
||||||
elif isinstance(media, types.MessageMediaGeo):
|
elif isinstance(media, types.MessageMediaGeo):
|
||||||
location = Location._parse(client, media.geo)
|
location = Location._parse(client, media.geo)
|
||||||
elif isinstance(media, types.MessageMediaContact):
|
elif isinstance(media, types.MessageMediaContact):
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ class Photo(Object):
|
||||||
height (``int``):
|
height (``int``):
|
||||||
Photo height.
|
Photo height.
|
||||||
|
|
||||||
|
ttl_seconds (``int``):
|
||||||
|
Time-to-live seconds, for secret photos.
|
||||||
|
|
||||||
file_size (``int``):
|
file_size (``int``):
|
||||||
File size.
|
File size.
|
||||||
|
|
||||||
|
|
@ -60,6 +63,7 @@ class Photo(Object):
|
||||||
file_ref: str,
|
file_ref: str,
|
||||||
width: int,
|
width: int,
|
||||||
height: int,
|
height: int,
|
||||||
|
ttl_seconds: int,
|
||||||
file_size: int,
|
file_size: int,
|
||||||
date: int,
|
date: int,
|
||||||
thumbs: List[Thumbnail]
|
thumbs: List[Thumbnail]
|
||||||
|
|
@ -70,12 +74,15 @@ class Photo(Object):
|
||||||
self.file_ref = file_ref
|
self.file_ref = file_ref
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
|
self.ttl_seconds = ttl_seconds
|
||||||
self.file_size = file_size
|
self.file_size = file_size
|
||||||
self.date = date
|
self.date = date
|
||||||
self.thumbs = thumbs
|
self.thumbs = thumbs
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse(client, photo: types.Photo) -> "Photo":
|
def _parse(client, media_photo: types.MessageMediaPhoto) -> "Photo":
|
||||||
|
photo = media_photo.photo
|
||||||
|
|
||||||
if isinstance(photo, types.Photo):
|
if isinstance(photo, types.Photo):
|
||||||
big = photo.sizes[-1]
|
big = photo.sizes[-1]
|
||||||
|
|
||||||
|
|
@ -91,6 +98,7 @@ class Photo(Object):
|
||||||
file_ref=encode_file_ref(photo.file_reference),
|
file_ref=encode_file_ref(photo.file_reference),
|
||||||
width=big.w,
|
width=big.w,
|
||||||
height=big.h,
|
height=big.h,
|
||||||
|
ttl_seconds=media_photo.ttl_seconds,
|
||||||
file_size=big.size,
|
file_size=big.size,
|
||||||
date=photo.date,
|
date=photo.date,
|
||||||
thumbs=Thumbnail._parse(client, photo),
|
thumbs=Thumbnail._parse(client, photo),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue