mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Better invalid arg responses
This commit is contained in:
@@ -57,7 +57,9 @@ module.exports = class CommandDispatcher {
|
||||
const parsedArgs = [];
|
||||
for (const parsedArg of infinite) {
|
||||
const valid = await arg.validate(parsedArg, msg, arg);
|
||||
if (!valid || typeof valid === 'string') {
|
||||
if (typeof valid === 'string') {
|
||||
return valid;
|
||||
} else if (!valid) {
|
||||
return stripIndents`
|
||||
An invalid value was provided for one of the "${arg.label || arg.key}" arguments.
|
||||
${arg.invalidText}
|
||||
@@ -81,7 +83,9 @@ module.exports = class CommandDispatcher {
|
||||
}
|
||||
}
|
||||
const valid = await arg.validate(parsedArg, msg, arg);
|
||||
if (!valid || typeof valid === 'string') {
|
||||
if (typeof valid === 'string') {
|
||||
return valid;
|
||||
} else if (!valid) {
|
||||
return stripIndents`
|
||||
An invalid value was provided for the "${arg.label || arg.key}" argument.
|
||||
${arg.invalidText}
|
||||
|
||||
Reference in New Issue
Block a user