Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Commit

Permalink
Help for commands can be retrieved by their alias
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnCZek committed Jul 10, 2020
1 parent c5473b0 commit 3333a5a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/commands/general/help.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ module.exports = class HelpCommand extends Command {
args: { command: string },
): Promise<Message | Message[]> {
const prefix = message.guild ? message.guild.commandPrefix : this.client.commandPrefix;
const commands = this.client.registry.commands.clone().sort(this.sortCommands);
// As message.message is not working, we need to cast the object instead to get that value
const msg = <Message><unknown>message;
// Determine whether the member is an administrator. Works only in guilds
Expand All @@ -43,7 +42,7 @@ module.exports = class HelpCommand extends Command {
text.push('');

let activeCategory: string;
commands.forEach((command: Command) => {
this.client.registry.commands.clone().sort(this.sortCommands).forEach((command: Command) => {
if (!command.isUsable(msg) || (command.hidden && !this.client.isOwner(message.author))) {
return;
}
Expand All @@ -59,7 +58,8 @@ module.exports = class HelpCommand extends Command {
return message.say(text, { code: 'asciidoc', split: true });
}

const command = commands.get(args.command);
const commands = this.client.registry.findCommands(args.command, true);
const command = commands.length > 0 ? commands[0] : null;
if (command && command.isUsable(msg) && (!command.hidden || this.client.isOwner(message.author))) {
const text = [
`__**Group:**__ ${command.group.name} (\`${command.groupID}\`)`,
Expand Down

0 comments on commit 3333a5a

Please sign in to comment.