telegram.ext.typehandler module

This module contains the TypeHandler class

class telegram.ext.typehandler.TypeHandler(type, callback, strict=False, pass_update_queue=False, pass_job_queue=False)

Bases: telegram.ext.handler.Handler

Handler class to handle updates of custom types.

Parameters:
  • type (type) – The type of updates this handler should process, as determined by isinstance
  • callback (function) – A function that takes bot, update as positional arguments. It will be called when the check_update has determined that an update should be processed by this handler.
  • strict (optional[bool]) – Use type instead of isinstance. Default is False
  • pass_update_queue (optional[bool]) – If set to True, a keyword argument called update_queue will be passed to the callback function. It will be the Queue instance used by the Updater and Dispatcher that contains new updates which can be used to insert updates. Default is False.
  • pass_job_queue (optional[bool]) – If set to True, a keyword argument called job_queue will be passed to the callback function. It will be a JobQueue instance created by the Updater which can be used to schedule new jobs. Default is False.
checkUpdate(*args, **kwargs)
check_update(update)
handleUpdate(*args, **kwargs)
handle_update(update, dispatcher)
m = 'telegram.TypeHandler.'