← 返回首页
TypeHandler - python-telegram-bot v22.8 Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Back to top

TypeHandler

class telegram.ext.TypeHandler(type, callback, strict=False, block=True)[source]

Bases: telegram.ext.BaseHandler

Handler class to handle updates of custom types.

Warning

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

Parameters: type[source]

The type of updates this handler should process.

Type:

type

callback[source]

The callback function for this handler.

Type:

coroutine function

strict[source]

Use type instead of isinstance. Default is False.

Type:

bool

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

check_update(update)[source]

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

Parameters:

update (object) – Incoming update.

Returns:

bool

Made with Sphinx and @pradyunsg's Furo