Skip to content

Commit 0768beb

Browse files
committed
(fix): Copy video_cover and video_start_timestamp in copy_message
1 parent b491401 commit 0768beb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pyrogram/types/messages_and_media/message.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4963,13 +4963,11 @@ async def copy(
49634963
"""
49644964
if self.service:
49654965
raise ValueError(
4966-
"Service messages cannot be copied. chat_id: %s, message_id: %s",
4967-
self.chat.id, self.id
4966+
f"Service messages cannot be copied. chat_id: {self.chat.id}, message_id: {self.id}"
49684967
)
49694968
elif self.game and not (self._client.me and self._client.me.is_bot):
49704969
raise ValueError(
4971-
"Users cannot send messages with Game media type. chat_id: %s, message_id: %s",
4972-
self.chat.id, self.id
4970+
f"Users cannot send messages with Game media type. chat_id: {self.chat.id}, message_id: {self.id}"
49734971
)
49744972
elif self.empty:
49754973
raise ValueError("Empty messages cannot be copied.")
@@ -5029,8 +5027,8 @@ async def copy(
50295027
parse_mode=parse_mode,
50305028
caption_entities=caption_entities,
50315029
show_caption_above_media=show_caption_above_media or self.show_caption_above_media,
5032-
cover=video_cover,
5033-
start_timestamp=video_start_timestamp,
5030+
cover=video_cover if video_cover else self.video.cover.sizes[-1].file_id if self.video.cover else None,
5031+
start_timestamp=video_start_timestamp if video_start_timestamp else self.video.start_timestamp,
50345032
has_spoiler=self.has_media_spoiler,
50355033
disable_notification=disable_notification,
50365034
protect_content=self.has_protected_content if protect_content is None else protect_content,

0 commit comments

Comments
 (0)