wait_for_callback_query()

async Client.wait_for_callback_query()

Wait for the next callback query in a chat.

Shortcut for listen() with a callback query listener.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Chat the callback query has to come from.

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

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

Returns:

CallbackQuery – The matching callback query.

Raises:
  • ListenerTimeout – In case no callback query arrived in time.

  • ListenerStopped – In case the listener was stopped, or the client is.

Example

query = await app.wait_for_callback_query(chat_id, timeout=30)