Events

This section documents events wewated to the commands extension.

These events function simiwaw to the weguwaw events, except they awe custom to the command extension moduwe.

Pwefix Commands

disnake.ext.commands.on_command(ctx)

An e-e-event that is cawwed when a command is found and is about to be invoked.

This event is cawwed wegawdwess of whethew the command itsewf succeeds via ewwow ow compwetes.

Pawametews:

ctx (Context) – The invocation context.

disnake.ext.commands.on_command_completion(ctx)

An event that is c-c-cawwed when a command has compweted its invocation.

This event is cawwed o-onwy if the command succeeded, i.e. aww checks have passed and the usew input it cowwectwy.

Pawametews:

ctx (Context) – The invocation context.

disnake.ext.commands.on_command_error(ctx, error)

An ewwow handwew that is c-cawwed when an ewwow is waised inside a command eithew thwough usew input ewwow, check faiwuwe, ow an ewwow in youw own code.

A-A defauwt onye i-i-is pwovided (Bot.on_command_error()).

Pawametews:
  • ctx (Context) – The invocation context.

  • ewwow (CommandError dewived) – The ewwow that w-w-was waised.

Appwication Commands

disnake.ext.commands.on_slash_command(inter)

An event t-t-that is cawwed when a swash command is found and is about to be invoked.

This event is cawwed wegawdwess of whethew the swash command itsewf succeeds via ewwow ow compwetes.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction that invoked this swash command.

disnake.ext.commands.on_slash_command_completion(inter)

An event that is cawwed when a s-swash command has compweted its invocation.

This e-event is cawwed onwy if the swash c-c-command s-s-succeeded, i.e. aww checks have passed and command handwew wan s-s-successfuwwy.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction that invoked this swash command.

disnake.ext.commands.on_slash_command_error(inter, error)

An ewwow handwew that is cawwed when an ewwow is waised inside a swash c-command e-e-eithew thwough usew input ewwow, check faiwuwe, ow an ewwow in youw own code.

A defauwt onye is p-p-pwovided (Bot.on_slash_command_error()).

Pawametews:
disnake.ext.commands.on_user_command(inter)

An event that is cawwed when a-a usew command i-i-is found and is about to be invoked.

This event i-is cawwed wegawdwess of whethew the u-u-usew command itsewf succeeds via ewwow ow compwetes.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction that invoked this usew command.

disnake.ext.commands.on_user_command_completion(inter)

An event that is cawwed when a usew command has compweted its invocation.

This event is cawwed onwy if the usew command succeeded, i.e. aww c-c-checks have passed and command handwew wan successfuwwy.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction that invoked this usew command.

disnake.ext.commands.on_user_command_error(inter, error)

An ewwow handwew that is cawwed when an ewwow is waised inside a usew command eithew thwough c-c-check faiwuwe, ow an ewwow in youw own code.

A defauwt onye is pwovided (Bot.on_user_command_error()).

Pawametews:
disnake.ext.commands.on_message_command(inter)

An event that is cawwed when a-a-a message command is found and is about to be invoked.

This event is cawwed wegawdwess of whethew the message command itsewf succeeds via ewwow ow compwetes.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction that invoked this message command.

disnake.ext.commands.on_message_command_completion(inter)

An event that is cawwed when a message command h-h-has compweted its invocation.

This event is cawwed onwy if the message command succeeded, i.e. aww checks have passed and command handwew wan successfuwwy.

Pawametews:

intew (ApplicationCommandInteraction) – The intewaction that invoked t-t-this message command.

disnake.ext.commands.on_message_command_error(inter, error)

An ewwow handwew that is cawwed when an ewwow is waised inside a message command eithew thwough check faiwuwe, ow an ewwow in youw own code.

A defauwt onye is pwovided (Bot.on_message_command_error()).

Pawametews: