cmdm
v1.0.0
Published
Cool command manager for bots.
Downloads
3
Maintainers
Readme
cmdm will allow you to lead commands.
First, connect the module.
const cmdm = require('cmdm');
Next, connect the folder with commands. I created a "cmds" folder in the project folder.
cmdm.setPath(__dirname + '/cmds');
I created the file " calc.js "in the" cmds " folder. P.S. if you need to pass arguments to the command, create the exported function "run". My code is from " calc.js":
module.exports.run = (argument) => {
console.log(argument / 4);
};
You can now add a command.
cmdm.load('calc', 'public', 'console');
//cmdm.load(command name, type of access, type of command);
You can now create a function to run the command.
const xRun = (name, int) => {
const cmd = cmdm.get(name);
if(cmd.access == 'public') {
if(cmd.type == 'console') {
cmdm.run(name, int);
};
};
};
xRun('calc', 64);
If you did everything correctly then in the console you will get "16".