mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 21:40:49 +02:00
Fix bugs
This commit is contained in:
@@ -39,9 +39,8 @@ module.exports = class CommandDispatcher {
|
||||
for (let i = 0; i < command.args.length; i++) {
|
||||
const arg = command.args[i];
|
||||
if (arg.infinite) {
|
||||
const infinite = parsed._.slice(i).map(j => j.toString());
|
||||
const parsedArgs = [];
|
||||
for (const parsedArg of infinite) {
|
||||
const infinite = parsed._.slice(i);
|
||||
if (!infinite.length) {
|
||||
if (arg.isEmpty(parsedArg, msg, arg)) {
|
||||
if (arg.default) {
|
||||
finalResult[arg.key] = typeof arg.default === 'function' ? arg.default(msg) : arg.default;
|
||||
@@ -50,6 +49,9 @@ module.exports = class CommandDispatcher {
|
||||
return `The "${arg.label || arg.key}" argument is required.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
const parsedArgs = [];
|
||||
for (const parsedArg of infinite) {
|
||||
const valid = await arg.validate(parsedArg, msg, arg);
|
||||
if (!valid) return `An invalid value was provided for one of the "${arg.label || arg.key}" arguments.`;
|
||||
parsedArgs.push(await arg.parse(parsedArg, msg, arg));
|
||||
|
||||
Reference in New Issue
Block a user