From 94d1291ffbc9bee35da70c23582cd18fdcf4455e Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Tue, 15 Aug 2023 17:51:08 +0300 Subject: [PATCH] Use command interface internally --- src/Parser.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Parser.ts b/src/Parser.ts index 63a276c..1c35e99 100644 --- a/src/Parser.ts +++ b/src/Parser.ts @@ -1,12 +1,12 @@ // eslint-disable-next-line max-classes-per-file import { EventEmitter } from 'events'; -import Command from './classes/Command.js'; import CommandOption from './classes/CommandOption.js'; import { OptionType } from "./interfaces/CommandOption.js"; import IResolver from './interfaces/Resolver.js'; import ExtendedMap from "./util/Map.js"; import Util from "./util/Util.js"; +import { ICommand } from '../index.js'; type ArgsResult = { [key: string]: CommandOption @@ -14,13 +14,13 @@ type ArgsResult = { type ParseResult = { args: ArgsResult, - command: Command, + command: ICommand, subcommand: string | null, subcommandGroup: string | null } type ParserOptions = { - commands: Iterable, + commands: Iterable, prefix?: string, debug?: boolean, resolver?: IResolver, @@ -29,7 +29,7 @@ type ParserOptions = { type ParseOptions = { prefix?: string, - commandFilter?: (cmd: Command) => boolean, + commandFilter?: (cmd: ICommand) => boolean, guild?: unknown } @@ -39,7 +39,7 @@ const flagReg = /(?:^| )(?(?:--[a-z0-9]{3,})|(?:-[a-z]{1,2}))(?:$| )/iu; class Parser extends EventEmitter { - private commands: ExtendedMap; + private commands: ExtendedMap; private _debug = false; prefix: string; resolver?: IResolver; @@ -50,7 +50,7 @@ class Parser extends EventEmitter { super(); this._debug = debug; - this.commands = new ExtendedMap(); + this.commands = new ExtendedMap(); for (const command of commands) this.commands.set(command.name, command); this.resolver = resolver; @@ -60,7 +60,7 @@ class Parser extends EventEmitter { } - private matchCommand (name: string): Command | null { + private matchCommand (name: string): ICommand | null { let command = null; if (this.commands.has(name)) command = this.commands.get(name);