Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit a09c5a3

Browse files
committed
Set has_media_spoiler only in case of Photo, Video or Animation media
1 parent fbd62f9 commit a09c5a3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyrogram/types/messages_and_media/message.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,11 +663,13 @@ async def _parse(
663663

664664
media = message.media
665665
media_type = None
666+
has_media_spoiler = None
666667

667668
if media:
668669
if isinstance(media, raw.types.MessageMediaPhoto):
669670
photo = types.Photo._parse(client, media.photo, media.ttl_seconds)
670671
media_type = enums.MessageMediaType.PHOTO
672+
has_media_spoiler = media.spoiler
671673
elif isinstance(media, raw.types.MessageMediaGeo):
672674
location = types.Location._parse(client, media.geo)
673675
media_type = enums.MessageMediaType.LOCATION
@@ -696,6 +698,7 @@ async def _parse(
696698
video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
697699
animation = types.Animation._parse(client, doc, video_attributes, file_name)
698700
media_type = enums.MessageMediaType.ANIMATION
701+
has_media_spoiler = media.spoiler
699702
elif raw.types.DocumentAttributeSticker in attributes:
700703
sticker = await types.Sticker._parse(client, doc, attributes)
701704
media_type = enums.MessageMediaType.STICKER
@@ -708,6 +711,7 @@ async def _parse(
708711
else:
709712
video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds)
710713
media_type = enums.MessageMediaType.VIDEO
714+
has_media_spoiler = media.spoiler
711715
elif raw.types.DocumentAttributeAudio in attributes:
712716
audio_attributes = attributes[raw.types.DocumentAttributeAudio]
713717

@@ -782,7 +786,7 @@ async def _parse(
782786
),
783787
author_signature=message.post_author,
784788
has_protected_content=message.noforwards,
785-
has_media_spoiler=media and media.spoiler,
789+
has_media_spoiler=has_media_spoiler,
786790
forward_from=forward_from,
787791
forward_sender_name=forward_sender_name,
788792
forward_from_chat=forward_from_chat,

0 commit comments

Comments
 (0)