1.1.1 • Published 5 years ago
command-manager-discord.js v1.1.1
D.JS command manager
This is a WIP project, currently it can read commands, execute commands and read their respective details (name, desc, usage) so that you finally use that thing u got from TSC Tutorials
module.exports.help = {
name: "dou",
description: "yes please",
usage: "what???"
}
In order to initialize this there are 3 things you need
x A message event
x A prefix
x A commands folder
Initializing
const Manager = require('command-manager-discord.js');
const { Client } = require('discord.js');
const client = new Client()
new Manager(client, 'commands') //you need your client (bot) and the name of the commands folder
Manager.prefix('!')
client.on('message', message => {
Manager.run(message)
// Nothing else!
});
If you followed my steps you'll have a working command manager The folder doesn't have to be named commands (when you initialize the manager you'll pass the name as a string)
Examples
This is the help
example
let x = Manager.help('play'); // It takes the name of the command as an argument
/* now 'x' has 3 properties
name
description
usage
*/
// if you don't add this \/ to your commands it'll give an error
module.exports.help = {
name: "",
description: "",
usage: ""
}
You can add this only to public commands, you don't actually need to add it to every single command
How to run the commands?
In order for this to work you need 1 thing, a function called run (this is bc most ppl use this name for their command function)
exports.run = (client, message, args, Discord) => {
//this is it
}