Skip to content

Commit

Permalink
Merge pull request #27 from yasirarism/main
Browse files Browse the repository at this point in the history
Fix for copy_message method
  • Loading branch information
wulan17 committed Nov 10, 2023
1 parent 681c21c commit 48a19ba
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -3524,6 +3524,7 @@ async def copy(
has_spoiler: bool = None,
disable_notification: bool = None,
message_thread_id: int = None,
quote_text: str = None,
reply_to_message_id: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
Expand Down Expand Up @@ -3580,6 +3581,10 @@ async def copy(
Unique identifier for the target message thread (topic) of the forum.
for forum supergroups only.
quote_text (``str``, *optional*):
Text to quote.
for reply_to_message only.
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
Expand Down Expand Up @@ -3615,10 +3620,11 @@ async def copy(
text=self.text,
entities=self.entities,
parse_mode=enums.ParseMode.DISABLED,
disable_web_page_preview=not self.web_page,
disable_web_page_preview=not self.web_page_preview,
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
quote_text=quote_text,
schedule_date=schedule_date,
protect_content=protect_content,
reply_markup=self.reply_markup if reply_markup is object else reply_markup
Expand Down Expand Up @@ -3701,6 +3707,23 @@ async def copy(
disable_notification=disable_notification,
message_thread_id=message_thread_id
)
elif self.web_page_preview:
return await self._client.send_web_page(
chat_id,
url=self.web_page_preview.webpage.url,
text=self.caption,
entities=self.entities,
parse_mode=enums.ParseMode.DISABLED,
large_media=self.web_page_preview.force_large_media,
invert_media=self.web_page_preview.invert_media,
disable_notification=disable_notification,
message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id,
quote_text=quote_text,
schedule_date=schedule_date,
protect_content=protect_content,
reply_markup=self.reply_markup if reply_markup is object else reply_markup
)
else:
raise ValueError("Unknown media type")

Expand Down

0 comments on commit 48a19ba

Please sign in to comment.