ChosenInlineResultHandler

class telegram.ext.ChosenInlineResultHandler(callback, block=True, pattern=None)[source]

Bases: telegram.ext.BaseHandler

Handler class to handle Telegram updates that contain telegram.Update.chosen_inline_result.

Warning

When setting block to False, you cannot rely on adding custom attributes to telegram.ext.CallbackContext. See its docs for more info.

Parameters:
callback[source]

The callback function for this handler.

Type:

coroutine function

block[source]

Determines whether the return value of the callback should be awaited before processing the next handler in telegram.ext.Application.process_update().

Type:

bool

pattern[source]

Optional. Regex pattern to test telegram.ChosenInlineResult.result_id against.

Added in version 13.6.

Type:

Pattern

check_update(update)[source]

Determines whether an update should be passed to this handler’s callback.

Parameters:

update (telegram.Update | object) – Incoming update.

Returns:

bool | re.match

collect_additional_context(context, update, application, check_result)[source]

This function adds the matched regex pattern result to telegram.ext.CallbackContext.matches.