From a7fc0e20136b1471b9d840897ab435b3e114b622 Mon Sep 17 00:00:00 2001 From: Vylpes Date: Sat, 28 Nov 2020 10:39:44 +0000 Subject: [PATCH] Change requiredConfigs to configs --- src/client/util.js | 8 ++++---- src/type/command.js | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/client/util.js b/src/client/util.js index 1adc68c..f66bb15 100644 --- a/src/client/util.js +++ b/src/client/util.js @@ -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 diff --git a/src/type/command.js b/src/type/command.js index e3f1885..95e520e 100644 --- a/src/type/command.js +++ b/src/type/command.js @@ -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