// Regular Discord.js StuffconstDiscord=require("discord.js");constclient=newDiscord.Client({ shardCount:1 });// Now we initialize the Objectconst { Commands } =require("djs-command-control");constcommands=newCommands( 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 classconst { Command } =require("djs-command-control");// Instatiate the objectconstcommand=newCommand();// Setting up all the variablescommand.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 permissioncommand.category ="general"; // The command should appear in the 'general' categorycommand.execute=async (message, options) => {// Do some example stuff };command.omitHelp =false; // This command should appear in Command// Export the commandmodule.exports= command;