Command Arguments
Command arguments are options where the user inputs their data which can help when the bot is doing actions with the command.
minArgs
and maxArgs
minArgs
and maxArgs
minArgs
(Minimum Arguments) and maxArgs
(Maximum Arguments) help the bot to understand how many arguments can be placed by the user when running a command. There are helpful when specifying values with expectedArgs
.
What is expectedArgs
?
expectedArgs
?expectedArgs
(Expected Arguments) is used to specify the arguments' names, and there are also annotations which you will need to apply.
If minArgs
is not specified (or is set to 0), all of these arguments will be optional. So you might think these annotations might be pretty useless. However, these annotations are required, and they can help you understand which argument is required and which is not in your command. This also applies to Slash Commands as well.
You can specify the exact arguments and the minimum/maximum number of arguments for each command. If the user provides an incorrect number of arguments then WOKCommands will automatically tell them the correct usage based off of the command properties you provided.
Let's create a new command "add" to show how arguments can be used in a command.
This "add" command adds numbers together, meaning the first and second arguments are required. So we set minArgs to 2, and num1
and num2
arguments will be wrapped in <>. Then, we will set maxArgs to the number of arguments specified in expectedArgs.
Once done, run the program, and test it out.
Last updated