mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Fix arg default in usage
This commit is contained in:
@@ -276,7 +276,7 @@ client.on('guildCreate', async guild => {
|
||||
}
|
||||
if (guild.systemChannel && guild.systemChannel.permissionsFor(client.user).has(PermissionFlagsBits.SendMessages)) {
|
||||
try {
|
||||
const usage = client.registry.commands.get('help').usage();
|
||||
const usage = client.registry.commands.get('help').usage(true);
|
||||
await guild.systemChannel.send(`Hi! I'm Xiao, use ${usage} to see my commands, yes?`);
|
||||
} catch {
|
||||
// Nothing!
|
||||
|
||||
@@ -39,9 +39,12 @@ module.exports = class Command {
|
||||
return this.client.registry.groups.get(this.groupID);
|
||||
}
|
||||
|
||||
usage() {
|
||||
const args = this.args
|
||||
.map(arg => `${arg.default ? '[' : '<'}${arg.label || arg.key}${arg.default ? ']' : '>'}`).join(' ');
|
||||
usage(noArgs = false) {
|
||||
const args = noArgs ? '' : this.args
|
||||
.map(arg => {
|
||||
const hasDefault = arg.default !== null;
|
||||
return `${hasDefault ? '[' : '<'}${arg.label || arg.key}${hasDefault ? ']' : '>'}`
|
||||
}).join(' ');
|
||||
return `\`${this.client.commandPrefix}${this.name} ${args}\` or \`@${this.client.user.tag} ${this.name} ${args}\``;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user