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.BaseHandlerHandler class to handle Telegram updates that contain a chat boost.
Warning
When setting
blocktoFalse, you cannot rely on adding custom attributes totelegram.ext.CallbackContext. See its docs for more info.Use In
Available In
Added in version 20.8.
- Parameters:
callback (coroutine function) –
The callback function for this handler. Will be called when
check_update()has determined that an update should be processed by this handler. Callback signature:async def callback(update: Update, context: CallbackContext)
The return value of the callback is usually ignored except for the special case of
telegram.ext.ConversationHandler.chat_boost_types (
int, optional) – Pass one ofCHAT_BOOST,REMOVED_CHAT_BOOSTorANY_CHAT_BOOSTto specify if this handler should handle only updates withtelegram.Update.chat_boost,telegram.Update.removed_chat_boostor both. Defaults toCHAT_BOOST.chat_id (
int| Collection[int], optional) – Filters reactions to allow only those which happen in the specified chat ID(s).chat_username (
str| Collection[str], optional) – Filters reactions to allow only those which happen in the specified username(s).Determines whether the return value of the callback should be awaited before processing the next handler in
telegram.ext.Application.process_update(). Defaults toTrue.See also
- chat_boost_types[source]¶
Optional. Specifies if this handler should handle only updates with
telegram.Update.chat_boost,telegram.Update.removed_chat_boostor both.- Type:
- ANY_CHAT_BOOST = 1[source]¶
Used as a constant to handle both
telegram.Update.chat_boostandtelegram.Update.removed_chat_boost.- Type:
- CHAT_BOOST = -1[source]¶
Used as a constant to handle only
telegram.Update.chat_boost.- Type:
- REMOVED_CHAT_BOOST = 0[source]¶
Used as a constant to handle only
telegram.Update.removed_chat_boost.- Type: