Message.wait_for_click()

async Message.wait_for_click()[source]

Bound method wait_for_click of Message.

Use as a shortcut for:

await client.listen(
    listener_type=enums.ListenerTypes.CALLBACK_QUERY,
    chat_id=message.chat.id,
    message_id=message.id
)

Example

sent = await message.reply("Pick one", reply_markup=keyboard)
query = await sent.wait_for_click(timeout=60)
Parameters:
  • user_id (int | str | List of int | str, optional) – Only accept a click from this user.

  • timeout (float, optional) – Seconds to wait before raising ListenerTimeout. Defaults to the client’s listener_timeout.

  • filters (Filter, optional) – Extra filter the callback query has to pass.

  • alert (bool | str, optional) – Answer clicks coming from a user this listener does not expect. Pass a string to set the text.

Returns:

CallbackQuery – The matching callback query.

Raises:

ListenerTimeout – In case nobody clicked in time.