TypeHandler¶
- class telegram.ext.TypeHandler(type, callback, strict=False, block=True)[source]¶
Bases:
telegram.ext.BaseHandlerHandler class to handle updates of custom types.
Warning
When setting
blocktoFalse, you cannot rely on adding custom attributes totelegram.ext.CallbackContext. See its docs for more info.Use In
Available In
- Parameters:
type (
type) – Thetypeof updates this handler should process, as determined byisinstancecallback (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: object, context: CallbackContext)
The return value of the callback is usually ignored except for the special case of
telegram.ext.ConversationHandler.strict (
bool, optional) – Usetypeinstead ofisinstance. Default isFalse.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
- 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: