telegram.ext.DispatcherHandlerStop

class telegram.ext.DispatcherHandlerStop(state: object = None)

Bases: Exception

Raise this in handler to prevent execution of any other handler (even in different group).

In order to use this exception in a telegram.ext.ConversationHandler, pass the optional state parameter instead of returning the next state:

def callback(update, context):
    ...
    raise DispatcherHandlerStop(next_state)
state

Optional. The next state of the conversation.

Type:object
Parameters:state (object, optional) – The next state of the conversation.