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 maxArgsWhat is expectedArgs?
expectedArgs?["<", "arg_name", ">"] // Required Arguments | Example: "<text>"
["[", "arg_name", "]"] // Optional Arguments | Example: "[text]"const { NoCliCommandType } = require("nocli-handler.js");
/**
* @type {import("nocli-handler.js").ICommand}
*/
const Command = {
type: NoCliCommandType.Legacy,
description: "Adds numbers together and prints out the sum",
testOnly: true,
minArgs: 2,
maxArgs: 3,
expectedArgs: "<num1> <num2> [num3]",
callback: ({ client, message, interaction, args, text }) => {
let sum = 0;
for (const arg of args) {
sum += parseInt(arg);
}
return 'The sum is ' + sum;
}
}
module.exports = Command;Last updated
