Setup Validations Path
Validations are functions that are executed before executing the command itself. Every time a command is triggered on Discord, your code will first execute all the initial checks (validations) that you have written. They act like middlewares do for APIs.
To setup validations, you must provide the validationsPath
property when creating a new instance of CommandHandler
.
Validations can only work in the presence of commandsPath
.
index.js
Different Validations Folder
As with both the commands and events path, your validationPath
can lead to a folder with any name anywhere. For example, if I have my validations saved inside a folder called bot-validations
, I would define validationPath
like this.
Last updated