Skip to content

Commit

Permalink
Fix conditions in handling show_caption_above_media
Browse files Browse the repository at this point in the history
  • Loading branch information
SpEcHiDe authored Nov 11, 2024
1 parent 9c0209a commit 70b6f40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pyrogram/methods/messages/edit_inline_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ async def edit_inline_media(
filename_attribute = []

if isinstance(media, types.InputMediaPhoto):
show_caption_above_media.append(media.show_caption_above_media)
if is_uploaded_file:
media = raw.types.InputMediaUploadedPhoto(
file=await self.save_file(media.media),
Expand All @@ -111,8 +112,8 @@ async def edit_inline_media(
)
else:
media = utils.get_input_media_from_file_id(media.media, FileType.PHOTO, has_spoiler=media.has_spoiler)
show_caption_above_media.append(media.show_caption_above_media)
elif isinstance(media, types.InputMediaVideo):
show_caption_above_media.append(media.show_caption_above_media)
if is_uploaded_file:
media = raw.types.InputMediaUploadedDocument(
mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "video/mp4",
Expand All @@ -135,7 +136,6 @@ async def edit_inline_media(
)
else:
media = utils.get_input_media_from_file_id(media.media, FileType.VIDEO, has_spoiler=media.has_spoiler)
show_caption_above_media.append(media.show_caption_above_media)
elif isinstance(media, types.InputMediaAudio):
if is_uploaded_file:
media = raw.types.InputMediaUploadedDocument(
Expand All @@ -157,6 +157,7 @@ async def edit_inline_media(
else:
media = utils.get_input_media_from_file_id(media.media, FileType.AUDIO)
elif isinstance(media, types.InputMediaAnimation):
show_caption_above_media.append(media.show_caption_above_media)
if is_uploaded_file:
media = raw.types.InputMediaUploadedDocument(
mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "video/mp4",
Expand All @@ -182,7 +183,6 @@ async def edit_inline_media(
)
else:
media = utils.get_input_media_from_file_id(media.media, FileType.ANIMATION)
show_caption_above_media.append(media.show_caption_above_media)
elif isinstance(media, types.InputMediaDocument):
if is_uploaded_file:
media = raw.types.InputMediaUploadedDocument(
Expand Down
6 changes: 3 additions & 3 deletions pyrogram/methods/messages/edit_message_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ async def edit_message_media(
filename_attribute = []

if isinstance(media, types.InputMediaPhoto):
show_caption_above_media.append(media.show_caption_above_media)
if is_uploaded_file:
uploaded_media = await self.invoke(
raw.functions.messages.UploadMedia(
Expand Down Expand Up @@ -150,8 +151,8 @@ async def edit_message_media(
)
else:
media = utils.get_input_media_from_file_id(media.media, FileType.PHOTO, has_spoiler=media.has_spoiler)
show_caption_above_media.append(media.show_caption_above_media)
elif isinstance(media, types.InputMediaVideo):
show_caption_above_media.append(media.show_caption_above_media)
if is_uploaded_file:
uploaded_media = await self.invoke(
raw.functions.messages.UploadMedia(
Expand Down Expand Up @@ -191,7 +192,6 @@ async def edit_message_media(
)
else:
media = utils.get_input_media_from_file_id(media.media, FileType.VIDEO, has_spoiler=media.has_spoiler)
show_caption_above_media.append(media.show_caption_above_media)
elif isinstance(media, types.InputMediaAudio):
if is_uploaded_file:
media = await self.invoke(
Expand Down Expand Up @@ -227,6 +227,7 @@ async def edit_message_media(
else:
media = utils.get_input_media_from_file_id(media.media, FileType.AUDIO)
elif isinstance(media, types.InputMediaAnimation):
show_caption_above_media.append(media.show_caption_above_media)
if is_uploaded_file:
uploaded_media = await self.invoke(
raw.functions.messages.UploadMedia(
Expand Down Expand Up @@ -265,7 +266,6 @@ async def edit_message_media(
)
else:
media = utils.get_input_media_from_file_id(media.media, FileType.ANIMATION, has_spoiler=media.has_spoiler)
show_caption_above_media.append(media.show_caption_above_media)
elif isinstance(media, types.InputMediaDocument):
if is_uploaded_file:
media = await self.invoke(
Expand Down

0 comments on commit 70b6f40

Please sign in to comment.