- When creating commands, it is very common to have to perform a check before the execution of the command in order to verify, - for example, if the executor of the command has a specific role, required permissions (non-exhaustive list). -
-
- These checks are usually recurring from command to command and must be duplicated which goes against the Don't Repeat Yourself principle.
- The role of middleware is to create a file that can be reused at will and used by any command that requires recurring checks.
-
- Creating a command with the framework is very simple. -
- -- Open a new terminal in your project and write the following command : -
-- A file will be created in the specified location otherwise in the root of your project with the following structure : -
-
- The version 13 update of discord.js marks the arrival of Slash Commands.
This new feature provides real support for developers who want to create commands on their bots.
-
- It was announced by Discord that they will gradually replace the old command system that we all knew based on the presence of a prefix as the first character of a message with this new suppo
-
- Open a new terminal in your project and write the following command : -
-- A file will be created in the specified location otherwise in the root of your project with the following structure : -
-- A file will be created in the specified location otherwise in the root of your project with the following structure : -
-
- See more about ApplicationCommandOption