Skip to content

Commit

Permalink
Make command calling case-insensitive
Browse files Browse the repository at this point in the history
Because I guess that's a priority for people
  • Loading branch information
zajrik committed Apr 20, 2017
1 parent b046d10 commit 910e3fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/command/CommandDispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ export class CommandDispatcher<T extends Client>
.split(' ')[0];

const command: Command<T> = this._client.commands.find(c =>
c.name === commandName || c.aliases.includes(commandName));
c.name.toLowerCase() === commandName.toLowerCase()
|| c.aliases.map(a => a.toLowerCase()).includes(commandName));

if (!command) return [false, null, null, null];
return [true, command, prefix, commandName];
Expand Down
4 changes: 1 addition & 3 deletions test/commands/test_command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export default class extends Command<Client>
super(client, {
name: 'test',
description: 'test command',
usage: '<prefix>test',
clientPermissions: ['MANAGE_GUILD'],
ratelimit: '2/10s'
usage: '<prefix>test'
});
}

Expand Down

0 comments on commit 910e3fd

Please sign in to comment.