Fix Hound Violations

This commit is contained in:
Vylpes 2020-10-30 23:03:19 +00:00
parent 2ec2e81853
commit de2d589504
2 changed files with 10 additions and 10 deletions

View file

@ -10,13 +10,13 @@ class event {
// Get the prefix from the config
let prefix = this.config.prefix;
// If the message starts with the prefix, then treat it as a command
// If the message starts with the prefix, then treat it as a command
if (message.content.substring(0, prefix.length).toLowerCase() == prefix.toLowerCase()) {
// Get the arguments in the message, after the first space (after the command name)
let args = message.content.substring(prefix.length).split(" ");
let name = args.shift();
// Load the command from the util class
// Load the command from the util class
this.util.loadCommand(name, args, message);
}
}

View file

@ -11,24 +11,24 @@ class util {
// Load a command and send the arguments with it
loadCommand(name, args, message) {
// Loop through all folders set in config
// c = command folder index
// Loop through all folders set in config
// c = command folder index
for (let c = 0; c < this._client.config.commands.length; c++) {
// Get the current folder to check
// Get the current folder to check
let folder = this._client.config.commands[c];
// See if the folder being checked has the command being sent
// See if the folder being checked has the command being sent
stat(`${process.cwd()}/${folder}/${name}.js`, err => {
// If no error, attempt to run the command
// If no error, attempt to run the command
if (err == null) {
// Require the command file, now that we know it exists and initialise it
// Require the command file, now that we know it exists and initialise it
let commandFile = require(`${process.cwd()}/${folder}/${name}.js`);
let command = new commandFile();
// Get the list of required configurations the command needs
// Get the list of required configurations the command needs
let requiredConfigs = command.requiredConfigs;
// Loop through all the required configs of the command
// Loop through all the required configs of the command
for (let i = 0; i < requiredConfigs.length; i++) {
// If the command doesn't have the configs in the config string, throw an error
if (!this._client.config[name]) throw `${commandFile.name} requires ${requiredConfigs[i]} in it's configuration`;