This commit is contained in:
Erik 2022-07-29 21:51:13 +03:00
parent 3e43b568c1
commit c6deb3764c
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "commandparser",
"version": "1.0.20",
"version": "1.0.21",
"description": "Parser meant to parse commands and their options for discord bots",
"main": "build/index.js",
"author": "Navy.gif",

View File

@ -82,9 +82,16 @@ class Parser extends EventEmitter {
const command = this.matchCommand(commandName);
if (!command) return null;
if (commandFilter && typeof commandFilter === 'function' && await commandFilter(command)) return null;
this.debug(`Matched command ${command.name}`);
if (commandFilter && typeof commandFilter === 'function') {
const result = await commandFilter(command);
if (result) {
this.debug(`Ignoring command ${command.name}`);
return null;
}
}
const { subcommands, subcommandGroups } = command;
const args: ArgsResult = {};
const parseResult: ParseResult = { args, command, subcommand: null, subcommandGroup: null };