Message.ask()

Message.ask()

Bound method ask of Message.

Use as a shortcut for:

client.send_message(chat_id, "What is your name?")

client.wait_for_message(chat_id)
Parameters:
  • text (str) – Text of the message to be sent.

  • quote (bool, optional) – If True, the message will be sent as a reply to this message. If reply_to_message_id is passed, this parameter will be ignored. Defaults to True in group chats and False in private chats.

  • parse_mode (ParseMode, optional) – By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together. Pass “markdown” or “md” to enable Markdown-style parsing only. Pass “html” to enable HTML-style parsing only. Pass None to completely disable style parsing.

  • entities (List of MessageEntity) – List of special entities that appear in message text, which can be specified instead of parse_mode.

  • disable_web_page_preview (bool, optional) – Disables link previews for links in this message.

  • disable_notification (bool, optional) – Sends the message silently. Users will receive a notification with no sound.

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | 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.

  • filters (Filters) – Pass one or more filters to allow only a subset of callback queries to be passed in your callback function.

  • timeout (int, optional) – Timeout in seconds.

Example

message.ask("What is your name?")
Returns:

Message – On success, the reply message is returned.

Raises:
  • RPCError – In case of a Telegram RPC error.

  • asyncio.TimeoutError – In case reply not received within the timeout.