1.0.0 • Published 6 years ago

cmdm v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

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".

Discord Server