From c6deb3764cf4b3ee562dd4ee5753f7fed8e97ba7 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 29 Jul 2022 21:51:13 +0300 Subject: [PATCH] debug --- package.json | 2 +- src/Parser.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f21bb18..7a9874e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/Parser.ts b/src/Parser.ts index 757d7f6..e0c915a 100644 --- a/src/Parser.ts +++ b/src/Parser.ts @@ -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 };