Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# ApplicationHandlerStop

class telegram.ext.ApplicationHandlerStop(state=None)

  Bases: `Exception`

  Raise this in a handler or an error handler to prevent execution of any other handler (even in different groups).

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

      async def conversation_callback(update, context):
          ...
          raise ApplicationHandlerStop(next_state)

  Note

  Has no effect, if the handler or error handler is run in a non-blocking way.

  Parameters:

    state (`object`, optional) – The next state of the conversation.

  state

    Optional. The next state of the conversation.

    Type:

      `object`