Command Handler

class bale.handlers.CommandHandler(command, check=None)

Bases: BaseHandler

This object shows a Message Handler. It’s a handler class to handle Messages.

Parameters:
  • command (Union[str, List[str]]) – The list of commands that the handler is required to cover. It can be a string or a list of strings.

  • check (Optional[Callable[["Update"], bool]]) –

    The check function for this handler.

    Hint

    Called in check_new_update(), when new update confirm. This checker indicates whether the Update should be covered by the handler or not.

check_new_update(update)

This function determines whether the “update” should be covered by the handler or not.

Parameters:

update (bale.Update) – The update to be tested.

Returns:

  • If False or None is returned, the update should not be wrapped by the handler,

  • otherwise the handler is required to wrapp that update.