// Regular Discord.js Stuff
const Discord = require("discord.js");
const client = new Discord.Client({ shardCount: 1 });
// Now we initialize the Object
const { Commands } = require("djs-command-control");
const commands = new Commands(
client,
"Commands", // The `Commands` Directory as specified above
{
prefix: process.env.PREFIX,
prefixOnMention: true,
}
);
Code appearing in Commands/example.js
Example code setup for the file inside the example command
// First importing the class
const { Command } = require("djs-command-control");
// Instatiate the object
const command = new Command();
// Setting up all the variables
command.name = "example";
command.description = "An Example Command";
command.invokes = ["example", "ex"]; // Command can both be invoked with 'ex' and 'example'
command.usage = "{{Example Parameter}}";
command.permission = ["MANAGE_GUILD"]; // Command can only be executed by users holding the MANAGE_GUILD permission
command.category = "general"; // The command should appear in the 'general' category
command.execute = async (message, options) => {
// Do some example stuff
};
command.omitHelp = false; // This command should appear in Command
// Export the command
module.exports = command;