mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Fix
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@ module.exports = class CommandClient extends Client {
|
||||
const parsed = await this.dispatcher.parseMessage(msg);
|
||||
if (typeof parsed === 'string') {
|
||||
const helpUsage = this.registry.commands.get('help').usage();
|
||||
await msg.reply(`${parsed} Use ${helpUsage} for more information.`);
|
||||
await msg.reply(`${parsed}\nUse ${helpUsage} for more information.`);
|
||||
return;
|
||||
}
|
||||
const { command, args } = parsed;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const minimist = require('minimist');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { list } = require('../util/Util');
|
||||
const argRegex = /"([^"]*)"|(\S+)/g;
|
||||
|
||||
module.exports = class CommandDispatcher {
|
||||
@@ -47,7 +48,10 @@ module.exports = class CommandDispatcher {
|
||||
finalResult[arg.key] = typeof arg.default === 'function' ? arg.default(msg) : arg.default;
|
||||
break;
|
||||
} else {
|
||||
return `The "${arg.label || arg.key}" argument is required.`;
|
||||
return stripIndents`
|
||||
The "${arg.label || arg.key}" argument is required.
|
||||
${arg.oneOf ? `It must be one of the following: ${list(arg.oneOf, 'or')}` : ''}
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +61,7 @@ module.exports = class CommandDispatcher {
|
||||
if (!valid || typeof valid === 'string') {
|
||||
return stripIndents`
|
||||
An invalid value was provided for one of the "${arg.label || arg.key}" arguments.
|
||||
${arg.oneOf ? `It must be one of the following: ${arg.oneOf.map(a => `\`${a}\``)}` : ''}
|
||||
${arg.oneOf ? `It must be one of the following: ${list(arg.oneOf, 'or')}` : ''}
|
||||
`;
|
||||
}
|
||||
parsedArgs.push(await arg.parse(parsedArg, msg, arg));
|
||||
@@ -70,7 +74,7 @@ module.exports = class CommandDispatcher {
|
||||
if (arg.default === null) {
|
||||
return stripIndents`
|
||||
The "${arg.label || arg.key}" argument is required.
|
||||
${arg.oneOf ? `It must be one of the following: ${arg.oneOf.map(a => `\`${a}\``)}` : ''}
|
||||
${arg.oneOf ? `It must be one of the following: ${list(arg.oneOf, 'or')}` : ''}
|
||||
`;
|
||||
} else {
|
||||
finalResult[arg.key] = typeof arg.default === 'function' ? arg.default(msg) : arg.default;
|
||||
@@ -81,7 +85,7 @@ module.exports = class CommandDispatcher {
|
||||
if (!valid || typeof valid === 'string') {
|
||||
return stripIndents`
|
||||
An invalid value was provided for the "${arg.label || arg.key}" argument.
|
||||
${arg.oneOf ? `It must be one of the following: ${arg.oneOf.map(a => `\`${a}\``)}` : ''}
|
||||
${arg.oneOf ? `It must be one of the following: ${list(arg.oneOf, 'or')}` : ''}
|
||||
`;
|
||||
}
|
||||
finalResult[arg.key] = await arg.parse(parsedArg, msg, arg);
|
||||
|
||||
Reference in New Issue
Block a user