Let's try this method

merge-requests/1/merge
Bsian 2019-11-19 20:26:08 +00:00
parent bb179d2854
commit e550c68fbe
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
2 changed files with 3 additions and 4 deletions

View File

@ -64,12 +64,11 @@ export default class Util {
} else if (resolvedCommand.subcommands.has(args[0])) { } else if (resolvedCommand.subcommands.has(args[0])) {
parentLabel += `${resolvedCommand.name} `; parentLabel += `${resolvedCommand.name} `;
resolvedCommand = resolvedCommand.subcommands.get(args[0]); args.shift(); resolvedCommand = resolvedCommand.subcommands.get(args[0]); args.shift();
parentLabel += `${resolvedCommand.name} `;
} else { } else {
const subcommandArray = resolvedCommand.subcommands.toArray(); const subcommandArray = resolvedCommand.subcommands.toArray();
for (const subCmd of subcommandArray) { for (const subCmd of subcommandArray) {
if (subCmd.aliases.includes(args[0])) { if (subCmd.aliases.includes(args[0])) {
parentLabel += `${resolvedCommand.name} `; resolvedCommand = subCmd; parentLabel += `${resolvedCommand.name} `; args.shift(); break; parentLabel += `${resolvedCommand.name} `; resolvedCommand = subCmd; args.shift(); break;
} }
if (subcommandArray.findIndex((v) => v === subCmd) === subcommandArray.length - 1) { if (subcommandArray.findIndex((v) => v === subCmd) === subcommandArray.length - 1) {
hasSubCommands = false; break; hasSubCommands = false; break;

View File

@ -53,10 +53,10 @@ export default class Help extends Command {
if (allowedUsers) { allowedUsers = `**Users:** ${allowedUsers}`; perms.push(allowedUsers); } if (allowedUsers) { allowedUsers = `**Users:** ${allowedUsers}`; perms.push(allowedUsers); }
const displayedPerms = perms.length ? `\n**Permissions:**\n${perms.join('\n')}` : ''; const displayedPerms = perms.length ? `\n**Permissions:**\n${perms.join('\n')}` : '';
const aliases = cmd.aliases.length ? `\n**Aliases:** ${cmd.aliases.map((alias) => `${this.client.config.prefix}${cmd.parentName}${alias}`).join(', ')}` : ''; const aliases = cmd.aliases.length ? `\n**Aliases:** ${cmd.aliases.map((alias) => `${this.client.config.prefix}${cmd.parentName}${alias}`).join(', ')}` : '';
const subcommands = cmd.subcommands.size ? `\n**Subcommands:** ${cmd.subcommands.map((s) => s.parentName || `${cmd.name} ${s.name}`).join(', ')}` : ''; const subcommands = cmd.subcommands.size ? `\n**Subcommands:** ${cmd.subcommands.map((s) => `${cmd.name} ${s.name}`).join(', ')}` : '';
const embed = new RichEmbed(); const embed = new RichEmbed();
embed.setTimestamp(); embed.setFooter(`Requested by ${message.author.username}#${message.author.discriminator}`, message.author.avatarURL); embed.setTimestamp(); embed.setFooter(`Requested by ${message.author.username}#${message.author.discriminator}`, message.author.avatarURL);
embed.setTitle(`${this.client.config.prefix}${cmd.parentName}${cmd.name}`); embed.setAuthor(`${this.client.user.username}#${this.client.user.discriminator}`, this.client.user.avatarURL); embed.setTitle(`${this.client.config.prefix}${cmd.parentName || cmd.name}`); embed.setAuthor(`${this.client.user.username}#${this.client.user.discriminator}`, this.client.user.avatarURL);
const description = `**Description**: ${cmd.description}\n**Usage:** ${cmd.usage}${aliases}${displayedPerms}${subcommands}`; const description = `**Description**: ${cmd.description}\n**Usage:** ${cmd.usage}${aliases}${displayedPerms}${subcommands}`;
embed.setDescription(description); embed.setDescription(description);
// @ts-ignore // @ts-ignore