commands package

class AbstractCommandErrorHandler[source]

Bases: ABC

An abstract command error handler.

abstract async handle_app_command_error(interaction, error)[source]

Handle error raised in the context of app commands.

Return type:

NoReturn

abstract async handle_text_command_error(context, error)[source]

Handle error raised in the context of text commands.

Return type:

NoReturn

abstract async should_handle_error(error)[source]

A predicate that determines whether the error should be handled.

Return type:

bool

class CommandErrorManager(default)[source]

Bases: object

A class that registers error handlers and handles all command related errors.

__init__(default)[source]
async handle_error(error, context_or_interaction)[source]

Handle a Discord exception.

Iterate through available handlers by registration order, and choose the first one capable of handling the error as determined by should_handle_error; there is no priority system.

Return type:

None

register_handler(handler)[source]

Register a command error handler.

Return type:

None

Submodules