1
0
Fork 0

Fix args lowercase

refactor/models
Bsian 2019-12-01 00:10:49 +00:00
parent af1827337f
commit 429a5fda8e
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 2 additions and 3 deletions

View File

@ -45,15 +45,14 @@ export default class Util {
try { try {
let resolvedCommand: Command; let resolvedCommand: Command;
if (typeof query === 'string') query = query.split(' '); if (typeof query === 'string') query = query.split(' ');
query = query.map((q) => q.toLowerCase());
const commands = this.client.commands.toArray(); const commands = this.client.commands.toArray();
resolvedCommand = commands.find((c) => c.name === query[0] || c.aliases.includes(query[0])); resolvedCommand = commands.find((c) => c.name === query[0].toLowerCase() || c.aliases.includes(query[0].toLowerCase()));
if (!resolvedCommand) return Promise.resolve(null); if (!resolvedCommand) return Promise.resolve(null);
query.shift(); query.shift();
while (resolvedCommand.subcommands.size) { while (resolvedCommand.subcommands.size) {
const subCommands = resolvedCommand.subcommands.toArray(); const subCommands = resolvedCommand.subcommands.toArray();
const found = subCommands.find((c) => c.name === query[0] || c.aliases.includes(query[0])); const found = subCommands.find((c) => c.name === query[0].toLowerCase() || c.aliases.includes(query[0].toLowerCase()));
if (!found) break; if (!found) break;
resolvedCommand = found; resolvedCommand = found;
query.shift(); query.shift();