Change requiredConfigs to configs

This commit is contained in:
Vylpes 2020-11-28 10:39:44 +00:00
parent 4a28665048
commit a7fc0e2013
2 changed files with 17 additions and 7 deletions

View file

@ -26,13 +26,13 @@ class util {
let command = new commandFile();
// Get the list of required configurations the command needs
let requiredConfigs = command.requiredConfigs;
let commandConfigs = command.configs;
// Loop through all the required configs of the command
for (let i = 0; i < requiredConfigs.length; i++) {
for (let i = 0; i < commandConfigs.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`;
if (!this._client.config[name][requiredConfigs[i]]) throw `${commandFile.name} requires ${requiredConfigs[i]} in it's configuration`;
if (!this._client.config[name]) throw `${commandFile.name} requires ${commandConfigs[i]} in it's configuration`;
if (!this._client.config[name][commandConfigs[i]]) throw `${commandFile.name} requires ${commandConfigs[i]} in it's configuration`;
}
// Get the roles required for this command to run

View file

@ -3,7 +3,7 @@ class command {
this.run = run;
this._roles = [];
this._requiredConfigs = [];
this._configs = [];
this._users = [];
}
@ -44,12 +44,22 @@ class command {
}
// Config
get configs() {
return this._configs;
}
set configs(conf) {
this._configs.push(conf);
}
get requiredConfigs() {
return this._requiredConfigs;
console.warn("'requiredConfigs' is deprecated and will be removed in a future version. Please use 'configs' instead.");
return this._configs;
}
set requiredConfigs(conf) {
this._requiredConfigs.push(conf);
console.warn("'requiredConfigs' is deprecated and will be removed in a future version. Please use 'configs' instead.");
this._configs.push(conf);
}
// Users