Merge pull request #27 from yasirarism/main

Fix for copy_message method
This commit is contained in:
2023-11-02 09:45:07 +00:00 committed by GitHub
commit fdd08df65d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3524,6 +3524,7 @@ class Message(Object, Update):
has_spoiler: bool = None, has_spoiler: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
quote_text: str = None,
reply_to_message_id: int = None, reply_to_message_id: int = None,
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
@ -3580,6 +3581,10 @@ class Message(Object, Update):
Unique identifier for the target message thread (topic) of the forum. Unique identifier for the target message thread (topic) of the forum.
for forum supergroups only. for forum supergroups only.
quote_text (``str``, *optional*):
Text to quote.
for reply_to_message only.
reply_to_message_id (``int``, *optional*): reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message. If the message is a reply, ID of the original message.
@ -3615,10 +3620,11 @@ class Message(Object, Update):
text=self.text, text=self.text,
entities=self.entities, entities=self.entities,
parse_mode=enums.ParseMode.DISABLED, 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, disable_notification=disable_notification,
message_thread_id=message_thread_id, message_thread_id=message_thread_id,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
quote_text=quote_text,
schedule_date=schedule_date, schedule_date=schedule_date,
protect_content=protect_content, protect_content=protect_content,
reply_markup=self.reply_markup if reply_markup is object else reply_markup reply_markup=self.reply_markup if reply_markup is object else reply_markup
@ -3701,6 +3707,23 @@ class Message(Object, Update):
disable_notification=disable_notification, disable_notification=disable_notification,
message_thread_id=message_thread_id 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: else:
raise ValueError("Unknown media type") raise ValueError("Unknown media type")