Change requiredConfigs to configs
This commit is contained in:
parent
4a28665048
commit
a7fc0e2013
2 changed files with 17 additions and 7 deletions
|
@ -26,13 +26,13 @@ class util {
|
||||||
let command = new commandFile();
|
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;
|
let commandConfigs = command.configs;
|
||||||
|
|
||||||
// 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++) {
|
for (let i = 0; i < commandConfigs.length; i++) {
|
||||||
// If the command doesn't have the configs in the config string, throw an error
|
// 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]) throw `${commandFile.name} requires ${commandConfigs[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][commandConfigs[i]]) throw `${commandFile.name} requires ${commandConfigs[i]} in it's configuration`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the roles required for this command to run
|
// Get the roles required for this command to run
|
||||||
|
|
|
@ -3,7 +3,7 @@ class command {
|
||||||
this.run = run;
|
this.run = run;
|
||||||
|
|
||||||
this._roles = [];
|
this._roles = [];
|
||||||
this._requiredConfigs = [];
|
this._configs = [];
|
||||||
this._users = [];
|
this._users = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,12 +44,22 @@ class command {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
|
get configs() {
|
||||||
|
return this._configs;
|
||||||
|
}
|
||||||
|
|
||||||
|
set configs(conf) {
|
||||||
|
this._configs.push(conf);
|
||||||
|
}
|
||||||
|
|
||||||
get requiredConfigs() {
|
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) {
|
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
|
// Users
|
||||||
|
|
Reference in a new issue