From 70b6f402f37df29435b04435cfb605af190f2a12 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Mon, 11 Nov 2024 14:36:25 +0530 Subject: [PATCH] Fix conditions in handling show_caption_above_media --- pyrogram/methods/messages/edit_inline_media.py | 6 +++--- pyrogram/methods/messages/edit_message_media.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyrogram/methods/messages/edit_inline_media.py b/pyrogram/methods/messages/edit_inline_media.py index 8308d80e5..44f38c248 100644 --- a/pyrogram/methods/messages/edit_inline_media.py +++ b/pyrogram/methods/messages/edit_inline_media.py @@ -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), @@ -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", @@ -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( @@ -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", @@ -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( diff --git a/pyrogram/methods/messages/edit_message_media.py b/pyrogram/methods/messages/edit_message_media.py index cbf41a867..0a35f7296 100644 --- a/pyrogram/methods/messages/edit_message_media.py +++ b/pyrogram/methods/messages/edit_message_media.py @@ -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( @@ -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( @@ -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( @@ -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( @@ -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(