The onError Function

The onError function will execute before the command is run, and terminate execution of the command. It will send whatever you wish, based on the errors created in the "validate" function. You can send whatever message you want for each error type, or just log something to your terminal. Whatever it is, it will happen before the command executes and will terminate any further execution.

Parameter Types

  • error: string

  • message: import("discord.js").Message

  • args: Array<string>

  • client: CDClient

  • prefix: string

  • language: keyof import("cdcommands/src/Base/Handling/Languages.json")