From bdda1f27a208f7949d8bc8332bebf0c73e130dc6 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Sun, 16 Feb 2025 00:27:39 +0530 Subject: [PATCH] Fix one mistake in copy_message (DD) Regression was introduced in 14c87558ce --- pyrogram/types/messages_and_media/message.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index d6f762f35..0eb8f7fa5 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -4834,7 +4834,9 @@ async def copy( send_as=send_as, reply_markup=self.reply_markup if reply_markup is object else reply_markup ) - + if caption is None: + caption = self.caption or "" + caption_entities = self.caption_entities if self.photo: file_id = self.photo.file_id elif self.audio: @@ -4979,10 +4981,6 @@ async def copy( else: raise ValueError("Unknown media type") - if caption is None: - caption = self.caption or "" - caption_entities = self.caption_entities - return await send_media( file_id=file_id, caption=caption,