Add reply_web_page bound method

This commit is contained in:
KurimuzonAkuma 2024-01-17 11:52:00 +03:00
parent 4054fff626
commit 978dd3c068
2 changed files with 131 additions and 0 deletions

View File

@ -614,6 +614,7 @@ def pyrogram_api():
Message.reply_video
Message.reply_video_note
Message.reply_voice
Message.reply_web_page
Message.get_media_group
Message.react
""",

View File

@ -3413,6 +3413,136 @@ class Message(Object, Update):
progress_args=progress_args
)
async def reply_web_page(
self,
text: str = None,
url: str = None,
force_large_media: bool = None,
force_small_media: bool = None,
parse_mode: Optional["enums.ParseMode"] = None,
entities: List["types.MessageEntity"] = None,
disable_notification: bool = None,
message_thread_id: int = None,
invert_media: bool = None,
reply_to_message_id: int = None,
reply_to_chat_id: Union[int, str] = None,
reply_to_story_id: int = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
quote_offset: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None
) -> "types.Message":
"""Bound method *reply_web_page* of :obj:`~pyrogram.types.Message`.
Use as a shortcut for:
.. code-block:: python
await client.send_web_page(
chat_id=message.chat.id,
url="https://docs.pyrogram.org"
)
Example:
.. code-block:: python
await message.reply_web_page("https://docs.pyrogram.org")
Parameters:
text (``str``, *optional*):
Text of the message to be sent.
url (``str``, *optional*):
Link that will be previewed.
If url not specified, the first URL found in the text will be used.
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
By default, texts are parsed using both Markdown and HTML styles.
You can combine both syntaxes together.
entities (List of :obj:`~pyrogram.types.MessageEntity`):
List of special entities that appear in message text, which can be specified instead of *parse_mode*.
force_large_media (``bool``, *optional*):
If True, media in the link preview will be larger.
Ignored if the URL isn't explicitly specified or media size change isn't supported for the preview.
force_small_media (``bool``, *optional*):
If True, media in the link preview will be smaller.
Ignored if the URL isn't explicitly specified or media size change isn't supported for the preview.
invert_media (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
disable_notification (``bool``, *optional*):
Sends the message silently.
Users will receive a notification with no sound.
message_thread_id (``int``, *optional*):
Unique identifier for the target message thread (topic) of the forum.
for forum supergroups only.
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
reply_to_chat_id (``int`` | ``str``, *optional*):
If the message is a reply, ID of the original chat.
reply_to_story_id (``int``, *optional*):
Unique identifier for the target story.
quote_text (``str``, *optional*):
Text of the quote to be sent.
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
quote_offset (``int``, *optional*):
Offset for quote in original message.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user.
Returns:
:obj:`~pyrogram.types.Message`: On success, the sent message is returned.
"""
return await self._client.send_web_page(
chat_id=self.chat.id,
text=text,
url=url,
force_large_media=force_large_media,
force_small_media=force_small_media,
parse_mode=parse_mode,
entities=entities,
disable_notification=disable_notification,
message_thread_id=message_thread_id,
invert_media=invert_media,
reply_to_message_id=reply_to_message_id,
reply_to_chat_id=reply_to_chat_id,
reply_to_story_id=reply_to_story_id,
quote_text=quote_text,
quote_entities=quote_entities,
quote_offset=quote_offset,
schedule_date=schedule_date,
protect_content=protect_content,
reply_markup=reply_markup
)
async def edit_text(
self,
text: str,