This commit is contained in:
Dragon Fire
2021-06-05 21:57:40 -04:00
parent b3a48fe14a
commit e33b34afb6
2 changed files with 11 additions and 11 deletions
+8 -8
View File
@@ -5,17 +5,17 @@ module.exports = class Argument {
Object.defineProperty(this, 'client', { value: client });
this.key = options.key.toLowerCase();
this.label = options.label || null;
this.label = typeof options.label === 'undefined' ? null : options.label;
this.typeID = options.type.toLowerCase();
this.min = options.min || null;
this.max = options.max || null;
this.oneOf = options.oneOf || null;
this.default = options.default || null;
this.min = typeof options.min === 'undefined' ? null : options.min;
this.max = typeof options.max === 'undefined' ? null : options.max;
this.oneOf = typeof options.oneOf === 'undefined' ? null : options.oneOf;
this.default = typeof options.default === 'undefined' ? null : options.default;
this.infinite = options.infinite || false;
this.avatarSize = options.avatarSize || 2048;
this.validator = options.validate || null;
this.parser = options.parse || null;
this.emptyChecker = options.isEmpty || null;
this.validator = typeof options.validate === 'undefined' ? null : options.validate;
this.parser = typeof options.parse === 'undefined' ? null : options.parse;
this.emptyChecker = typeof options.isEmpty === 'undefined' ? null : options.isEmpty;
}
get type() {
+3 -3
View File
@@ -58,11 +58,11 @@ module.exports = class CommandDispatcher {
}
const parsedArg = parsed._[i]?.toString();
if (arg.isEmpty(parsedArg, msg, arg)) {
if (arg.default !== null) {
if (arg.default === null) {
return `The "${arg.label || arg.key}" argument is required.`;
} else {
finalResult[arg.key] = typeof arg.default === 'function' ? arg.default(msg) : arg.default;
continue;
} else {
return `The "${arg.label || arg.key}" argument is required.`;
}
}
const valid = await arg.validate(parsedArg, msg, arg);