CallbackQueryHandler¶
- class pyrogram.handlers.CallbackQueryHandler
Bases:
HandlerThe CallbackQuery handler class. Used to handle callback queries coming from inline buttons. It is intended to be used with
add_handler()For a nicer way to register this handler, have a look at the
on_callback_query()decorator.- Parameters:
callback (
Callable) – Pass a function that will be called when a new CallbackQuery arrives. It takes (client, callback_query) as positional arguments (look at the section below for a detailed description).filters (
Filters) – Pass one or more filters to allow only a subset of callback queries to be passed in your callback function.
- Other Parameters:
client (
Client) – The Client itself, useful when you want to call other API methods inside the message handler.callback_query (
CallbackQuery) – The received callback query.
- compose_data_identifier(query)
Composes an Identifier object from a CallbackQuery object.
- Parameters:
query – The CallbackQuery object to compose of.
- Returns:
An Identifier object.
- async check_if_has_matching_listener(client, query)
Checks if the CallbackQuery object has a matching listener.
- Parameters:
client – The Client object to check with.
query – The CallbackQuery object to check with.
- Returns:
A tuple of a boolean and a Listener object. The boolean indicates whether the found listener has filters and its filters matches with the CallbackQuery object. The Listener object is the matching listener.
- async check(client, query)
Checks if the CallbackQuery object has a matching listener or handler.
- Parameters:
client – The Client object to check with.
query – The CallbackQuery object to check with.
- Returns:
A boolean indicating whether the CallbackQuery object has a matching listener or the handler filter matches.
- async resolve_future_or_callback(client, query, *args)
Resolves the future or calls the callback of the listener. Will call the original handler if no listener.
- Parameters:
client – The Client object to resolve or call with.
query – The CallbackQuery object to resolve or call with.
args – The arguments to call the callback with.
- Returns:
None