ask()

Client.ask()

Send a message then listen for a message, callback query, etc.

Message:

Usable by Users Bots

CallbackQuery:

Usable by Users Bots
Parameters:
  • chat_id (int | str | Iterable of int | Iterable of str) – Unique identifier (int) or username (str) of the target chat.

  • text (str) – Text of the message to be sent.

  • user_id (int | str | Iterable of int | Iterable of str, optional) – The user ID to listen for.

  • filters (filters, optional) – A filter to check the incoming message against.

  • listener_type (ListenerTypes, optional) – The type of listener to listen for. Default to Message.

  • timeout (int, optional) – The maximum amount of time to wait for a message.

  • unallowed_click_alert (bool, optional) – Whether to alert the user if they click a button that doesn’t match the filters. Default to True.

  • inline_message_id (str, optional) – The inline message ID to listen for.

Returns:

Message | CallbackQuery – On success, a message/callbackquery is returned.

Example

await app.ask(chat_id, "Tell me your name:")