diff --git a/structure/client/components/observers/CommandHandler.js b/structure/client/components/observers/CommandHandler.js index 877470a..3011192 100644 --- a/structure/client/components/observers/CommandHandler.js +++ b/structure/client/components/observers/CommandHandler.js @@ -167,10 +167,6 @@ class CommandHandler extends Observer { let currentArgument = null; for(let i=0; ia.requiredArgument && !a.value); + const blah = parsedArguments.filter(a=>a.requiredArgument && !a.value); //check if array, too lazy. const missingArgument = blah[0]; if(missingArgument) return { error: true, @@ -346,7 +339,7 @@ class CommandHandler extends Observer { const parse = async (argument, string, guild) => { const { error, value } = await this.constructor.parseType(argument.type, string, this.client.resolver, guild); //Cannot access static functions through "this". - if(error) return { error: true }; + if(error || value === null) return { error: true }; if(['INTEGER', 'FLOAT'].includes(argument.type)) { const { min, max } = argument; @@ -376,12 +369,11 @@ class CommandHandler extends Observer { }; const { error, value } = await parse(argument, string, guild); + if(error || value === '') return true; - if(!error && (value !== undefined || value !== '')) { - argument.infinite - ? argument.value.push(value) - : argument.value = value; - } + argument.infinite + ? argument.value.push(value) + : argument.value = value; return error; @@ -498,7 +490,7 @@ class CommandHandler extends Observer { const types = { STRING: (str) => { - return { error: false, value: `${str}` }; + return { error: false, value: str }; }, INTEGER: (str) => { const int = parseInt(str); diff --git a/structure/client/components/settings/moderation/Modlogs.js b/structure/client/components/settings/moderation/Modlogs.js index 8a92bb0..746d466 100644 --- a/structure/client/components/settings/moderation/Modlogs.js +++ b/structure/client/components/settings/moderation/Modlogs.js @@ -43,8 +43,6 @@ class Modlogs extends Setting { async handle(message, args) { const { params, parsedArguments } = await this._parseArguments(args, message.guild, true); - console.log(params) - console.log(Object.values(parsedArguments).map(a=>`${a.name} - ${a.value}`)); let setting = message.guild._settings.modlogs || { }; if (parsedArguments.exclude) { diff --git a/structure/interfaces/Argument.js b/structure/interfaces/Argument.js index 6d9e25d..7540e44 100644 --- a/structure/interfaces/Argument.js +++ b/structure/interfaces/Argument.js @@ -8,7 +8,7 @@ class Argument { this.description = options.description; this.aliases = options.aliases || []; //Aliases will work for both verbal and flag types. Careful for multiple aliases starting with different letters: more flags, more confusing. - this.type = (options.type && Constants.Types.includes(options.type) ? options.type : 'BOOLEAN'); //What type the argument is ['STRING', 'INTEGER', 'FLOAT', 'BOOLEAN']. + this.type = options.type && Constants.Types.includes(options.type) ? options.type : 'BOOLEAN'; //What type the argument is ['STRING', 'INTEGER', 'FLOAT', 'BOOLEAN']. this.types = options.types || ['FLAG', 'VERBAL']; //['FLAG'], ['VERBAL'], or ['FLAG', 'VERBAL']. Declares if argument can be used verbally-only, flag-only, or both. this.prompts = options.prompts || { @@ -20,7 +20,7 @@ class Argument { this.requiredValue = Boolean(options.requiredValue); this.required = options.type === 'BOOLEAN' ? false : Boolean(options.required); //If the argument must be required for the command to work. Booleans - this.default = options.default === null ? Constants.Defaults[options.type] : options.default; + this.default = options.default === null ? Constants.Defaults[options.type] : options.default; this.infinite = Boolean(options.infinite); //Accepts infinite amount of arguments e.g. -u @nolan @navy. If false, will only detect one user. // Will turn value into an array instead of a string!!! @@ -41,7 +41,7 @@ module.exports = Argument; const Constants = { Defaults: { //these dont really mean anything, just default values. Most important one is the boolean one. - STRING: '', + STRING: 'wh', INTEGER: 0, FLOAT: 0, BOOLEAN: true