mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Set has_media_spoiler only in case of Photo, Video or Animation media
This commit is contained in:
parent
64177b533c
commit
482798c2fc
1 changed files with 5 additions and 1 deletions
|
|
@ -768,11 +768,13 @@ class Message(Object, Update):
|
||||||
|
|
||||||
media = message.media
|
media = message.media
|
||||||
media_type = None
|
media_type = None
|
||||||
|
has_media_spoiler = None
|
||||||
|
|
||||||
if media:
|
if media:
|
||||||
if isinstance(media, raw.types.MessageMediaPhoto):
|
if isinstance(media, raw.types.MessageMediaPhoto):
|
||||||
photo = types.Photo._parse(client, media.photo, media.ttl_seconds)
|
photo = types.Photo._parse(client, media.photo, media.ttl_seconds)
|
||||||
media_type = enums.MessageMediaType.PHOTO
|
media_type = enums.MessageMediaType.PHOTO
|
||||||
|
has_media_spoiler = media.spoiler
|
||||||
elif isinstance(media, raw.types.MessageMediaGeo):
|
elif isinstance(media, raw.types.MessageMediaGeo):
|
||||||
location = types.Location._parse(client, media.geo)
|
location = types.Location._parse(client, media.geo)
|
||||||
media_type = enums.MessageMediaType.LOCATION
|
media_type = enums.MessageMediaType.LOCATION
|
||||||
|
|
@ -801,6 +803,7 @@ class Message(Object, Update):
|
||||||
video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
|
video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
|
||||||
animation = types.Animation._parse(client, doc, video_attributes, file_name)
|
animation = types.Animation._parse(client, doc, video_attributes, file_name)
|
||||||
media_type = enums.MessageMediaType.ANIMATION
|
media_type = enums.MessageMediaType.ANIMATION
|
||||||
|
has_media_spoiler = media.spoiler
|
||||||
elif raw.types.DocumentAttributeSticker in attributes:
|
elif raw.types.DocumentAttributeSticker in attributes:
|
||||||
sticker = await types.Sticker._parse(client, doc, attributes)
|
sticker = await types.Sticker._parse(client, doc, attributes)
|
||||||
media_type = enums.MessageMediaType.STICKER
|
media_type = enums.MessageMediaType.STICKER
|
||||||
|
|
@ -813,6 +816,7 @@ class Message(Object, Update):
|
||||||
else:
|
else:
|
||||||
video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds)
|
video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds)
|
||||||
media_type = enums.MessageMediaType.VIDEO
|
media_type = enums.MessageMediaType.VIDEO
|
||||||
|
has_media_spoiler = media.spoiler
|
||||||
elif raw.types.DocumentAttributeAudio in attributes:
|
elif raw.types.DocumentAttributeAudio in attributes:
|
||||||
audio_attributes = attributes[raw.types.DocumentAttributeAudio]
|
audio_attributes = attributes[raw.types.DocumentAttributeAudio]
|
||||||
|
|
||||||
|
|
@ -889,7 +893,7 @@ class Message(Object, Update):
|
||||||
),
|
),
|
||||||
author_signature=message.post_author,
|
author_signature=message.post_author,
|
||||||
has_protected_content=message.noforwards,
|
has_protected_content=message.noforwards,
|
||||||
has_media_spoiler=media and media.spoiler,
|
has_media_spoiler=has_media_spoiler,
|
||||||
forward_from=forward_from,
|
forward_from=forward_from,
|
||||||
forward_sender_name=forward_sender_name,
|
forward_sender_name=forward_sender_name,
|
||||||
forward_from_chat=forward_from_chat,
|
forward_from_chat=forward_from_chat,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue