mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -11,10 +11,28 @@ module.exports = class Argument {
|
||||
this.oneOf = options.oneOf;
|
||||
this.default = options.default;
|
||||
this.avatarSize = options.avatarSize || 2048;
|
||||
this.validator = options.validate;
|
||||
this.parser = options.parse;
|
||||
this.emptyChecker = options.isEmpty;
|
||||
}
|
||||
|
||||
get type() {
|
||||
if (this.typeID.includes('|')) return new UnionType(this.client, this.typeID);
|
||||
return this.client.registry.types.get(this.typeID);
|
||||
}
|
||||
|
||||
validate(val, msg, arg) {
|
||||
if (this.validator) return this.validator(val, msg, arg);
|
||||
return this.type.validate(val, msg, arg);
|
||||
}
|
||||
|
||||
parse(val, msg, arg) {
|
||||
if (this.parser) return this.parser(val, msg, arg);
|
||||
return this.type.parse(val, msg, arg);
|
||||
}
|
||||
|
||||
isEmpty(val, msg, arg) {
|
||||
if (this.emptyChecker) return this.emptyChecker(val, msg, arg);
|
||||
return this.type.isEmpty(val, msg, arg);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user