mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-22 01:47:34 +00:00
Set has_media_spoiler only in case of Photo, Video or Animation media
This commit is contained in:
parent
fbd62f9596
commit
a09c5a3b98
@ -663,11 +663,13 @@ class Message(Object, Update):
|
||||
|
||||
media = message.media
|
||||
media_type = None
|
||||
has_media_spoiler = None
|
||||
|
||||
if media:
|
||||
if isinstance(media, raw.types.MessageMediaPhoto):
|
||||
photo = types.Photo._parse(client, media.photo, media.ttl_seconds)
|
||||
media_type = enums.MessageMediaType.PHOTO
|
||||
has_media_spoiler = media.spoiler
|
||||
elif isinstance(media, raw.types.MessageMediaGeo):
|
||||
location = types.Location._parse(client, media.geo)
|
||||
media_type = enums.MessageMediaType.LOCATION
|
||||
@ -696,6 +698,7 @@ class Message(Object, Update):
|
||||
video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
|
||||
animation = types.Animation._parse(client, doc, video_attributes, file_name)
|
||||
media_type = enums.MessageMediaType.ANIMATION
|
||||
has_media_spoiler = media.spoiler
|
||||
elif raw.types.DocumentAttributeSticker in attributes:
|
||||
sticker = await types.Sticker._parse(client, doc, attributes)
|
||||
media_type = enums.MessageMediaType.STICKER
|
||||
@ -708,6 +711,7 @@ class Message(Object, Update):
|
||||
else:
|
||||
video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds)
|
||||
media_type = enums.MessageMediaType.VIDEO
|
||||
has_media_spoiler = media.spoiler
|
||||
elif raw.types.DocumentAttributeAudio in attributes:
|
||||
audio_attributes = attributes[raw.types.DocumentAttributeAudio]
|
||||
|
||||
@ -782,7 +786,7 @@ class Message(Object, Update):
|
||||
),
|
||||
author_signature=message.post_author,
|
||||
has_protected_content=message.noforwards,
|
||||
has_media_spoiler=media and media.spoiler,
|
||||
has_media_spoiler=has_media_spoiler,
|
||||
forward_from=forward_from,
|
||||
forward_sender_name=forward_sender_name,
|
||||
forward_from_chat=forward_from_chat,
|
||||
|
Loading…
x
Reference in New Issue
Block a user