@@ -3604,3 +3604,103 @@ async def unpin(self) -> bool:
36043604 chat_id = self .chat .id ,
36053605 message_id = self .id
36063606 )
3607+
3608+ async def ask (
3609+ self ,
3610+ text : str ,
3611+ quote : bool = None ,
3612+ parse_mode : Optional [str ] = object ,
3613+ entities : List ["types.MessageEntity" ] = None ,
3614+ disable_web_page_preview : bool = None ,
3615+ disable_notification : bool = None ,
3616+ reply_to_message_id : int = None ,
3617+ reply_markup = None ,
3618+ filters = None ,
3619+ timeout : int = None
3620+ ) -> "Message" :
3621+ """Bound method *ask* of :obj:`~pyrogram.types.Message`.
3622+
3623+ Use as a shortcut for:
3624+
3625+ .. code-block:: python
3626+
3627+ client.send_message(chat_id, "What is your name?")
3628+ client.wait_for_message(chat_id)
3629+
3630+ Example:
3631+ .. code-block:: python
3632+
3633+ message.ask("What is your name?")
3634+
3635+ Parameters:
3636+ text (``str``):
3637+ Text of the message to be sent.
3638+
3639+ quote (``bool``, *optional*):
3640+ If ``True``, the message will be sent as a reply to this message.
3641+ If *reply_to_message_id* is passed, this parameter will be ignored.
3642+ Defaults to ``True`` in group chats and ``False`` in private chats.
3643+
3644+ parse_mode (``str``, *optional*):
3645+ By default, texts are parsed using both Markdown and HTML styles.
3646+ You can combine both syntaxes together.
3647+ Pass "markdown" or "md" to enable Markdown-style parsing only.
3648+ Pass "html" to enable HTML-style parsing only.
3649+ Pass None to completely disable style parsing.
3650+
3651+ entities (List of :obj:`~pyrogram.types.MessageEntity`):
3652+ List of special entities that appear in message text, which can be specified instead of *parse_mode*.
3653+
3654+ disable_web_page_preview (``bool``, *optional*):
3655+ Disables link previews for links in this message.
3656+
3657+ disable_notification (``bool``, *optional*):
3658+ Sends the message silently.
3659+ Users will receive a notification with no sound.
3660+
3661+ reply_to_message_id (``int``, *optional*):
3662+ If the message is a reply, ID of the original message.
3663+
3664+ reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
3665+ Additional interface options. An object for an inline keyboard, custom reply keyboard,
3666+ instructions to remove reply keyboard or to force a reply from the user.
3667+
3668+ filters (:obj:`Filters`):
3669+ Pass one or more filters to allow only a subset of callback queries to be passed
3670+ in your callback function.
3671+
3672+ timeout (``int``, *optional*):
3673+ Timeout in seconds.
3674+
3675+ Returns:
3676+ :obj:`~pyrogram.types.Message`: On success, the reply message is returned.
3677+
3678+ Raises:
3679+ RPCError: In case of a Telegram RPC error.
3680+ asyncio.TimeoutError: In case reply not received within the timeout.
3681+ """
3682+ if quote is None :
3683+ quote = self .chat .type != "private"
3684+
3685+ if reply_to_message_id is None and quote :
3686+ reply_to_message_id = self .id
3687+
3688+ request = await self ._client .send_message (
3689+ chat_id = self .chat .id ,
3690+ text = text ,
3691+ parse_mode = parse_mode ,
3692+ entities = entities ,
3693+ disable_web_page_preview = disable_web_page_preview ,
3694+ disable_notification = disable_notification ,
3695+ reply_to_message_id = reply_to_message_id ,
3696+ reply_markup = reply_markup
3697+ )
3698+
3699+ reply_message = await self ._client .wait_for_message (
3700+ self .chat .id ,
3701+ filters = filters ,
3702+ timeout = timeout
3703+ )
3704+
3705+ reply_message .request = request
3706+ return reply_message
0 commit comments