@@ -3525,3 +3525,103 @@ async def unpin(self) -> bool:
35253525 chat_id = self .chat .id ,
35263526 message_id = self .message_id
35273527 )
3528+
3529+ async def ask (
3530+ self ,
3531+ text : str ,
3532+ quote : bool = None ,
3533+ parse_mode : Optional [str ] = object ,
3534+ entities : List ["types.MessageEntity" ] = None ,
3535+ disable_web_page_preview : bool = None ,
3536+ disable_notification : bool = None ,
3537+ reply_to_message_id : int = None ,
3538+ reply_markup = None ,
3539+ filters = None ,
3540+ timeout : int = None
3541+ ) -> "Message" :
3542+ """Bound method *ask* of :obj:`~pyrogram.types.Message`.
3543+
3544+ Use as a shortcut for:
3545+
3546+ .. code-block:: python
3547+
3548+ client.send_message(chat_id, "What is your name?")
3549+ client.wait_for_message(chat_id)
3550+
3551+ Example:
3552+ .. code-block:: python
3553+
3554+ message.ask("What is your name?")
3555+
3556+ Parameters:
3557+ text (``str``):
3558+ Text of the message to be sent.
3559+
3560+ quote (``bool``, *optional*):
3561+ If ``True``, the message will be sent as a reply to this message.
3562+ If *reply_to_message_id* is passed, this parameter will be ignored.
3563+ Defaults to ``True`` in group chats and ``False`` in private chats.
3564+
3565+ parse_mode (``str``, *optional*):
3566+ By default, texts are parsed using both Markdown and HTML styles.
3567+ You can combine both syntaxes together.
3568+ Pass "markdown" or "md" to enable Markdown-style parsing only.
3569+ Pass "html" to enable HTML-style parsing only.
3570+ Pass None to completely disable style parsing.
3571+
3572+ entities (List of :obj:`~pyrogram.types.MessageEntity`):
3573+ List of special entities that appear in message text, which can be specified instead of *parse_mode*.
3574+
3575+ disable_web_page_preview (``bool``, *optional*):
3576+ Disables link previews for links in this message.
3577+
3578+ disable_notification (``bool``, *optional*):
3579+ Sends the message silently.
3580+ Users will receive a notification with no sound.
3581+
3582+ reply_to_message_id (``int``, *optional*):
3583+ If the message is a reply, ID of the original message.
3584+
3585+ reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
3586+ Additional interface options. An object for an inline keyboard, custom reply keyboard,
3587+ instructions to remove reply keyboard or to force a reply from the user.
3588+
3589+ filters (:obj:`Filters`):
3590+ Pass one or more filters to allow only a subset of callback queries to be passed
3591+ in your callback function.
3592+
3593+ timeout (``int``, *optional*):
3594+ Timeout in seconds.
3595+
3596+ Returns:
3597+ :obj:`~pyrogram.types.Message`: On success, the reply message is returned.
3598+
3599+ Raises:
3600+ RPCError: In case of a Telegram RPC error.
3601+ asyncio.TimeoutError: In case reply not received within the timeout.
3602+ """
3603+ if quote is None :
3604+ quote = self .chat .type != "private"
3605+
3606+ if reply_to_message_id is None and quote :
3607+ reply_to_message_id = self .message_id
3608+
3609+ request = await self ._client .send_message (
3610+ chat_id = self .chat .id ,
3611+ text = text ,
3612+ parse_mode = parse_mode ,
3613+ entities = entities ,
3614+ disable_web_page_preview = disable_web_page_preview ,
3615+ disable_notification = disable_notification ,
3616+ reply_to_message_id = reply_to_message_id ,
3617+ reply_markup = reply_markup
3618+ )
3619+
3620+ reply_message = await self ._client .wait_for_message (
3621+ self .chat .id ,
3622+ filters = filters ,
3623+ timeout = timeout
3624+ )
3625+
3626+ reply_message .request = request
3627+ return reply_message
0 commit comments