ChatBoostHandler

Added in version 20.8.

class telegram.ext.ChatBoostHandler(callback, chat_boost_types=-1, chat_id=None, chat_username=None, block=True)[source]

Bases: telegram.ext.BaseHandler

Handler class to handle Telegram updates that contain a chat boost.

Warning

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

Added in version 20.8.

Parameters:
callback[source]

The callback function for this handler.

Type:

coroutine function

chat_boost_types[source]

Optional. Specifies if this handler should handle only updates with telegram.Update.chat_boost, telegram.Update.removed_chat_boost or both.

Type:

int

block[source]

Determines whether the callback will run in a blocking way.

Type:

bool

ANY_CHAT_BOOST = 1[source]

Used as a constant to handle both telegram.Update.chat_boost and telegram.Update.removed_chat_boost.

Type:

int

CHAT_BOOST = -1[source]

Used as a constant to handle only telegram.Update.chat_boost.

Type:

int

REMOVED_CHAT_BOOST = 0[source]

Used as a constant to handle only telegram.Update.removed_chat_boost.

Type:

int

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