diff --git a/public/scripts/slash-commands/SlashCommand.js b/public/scripts/slash-commands/SlashCommand.js index 905967373..84e441e6b 100644 --- a/public/scripts/slash-commands/SlashCommand.js +++ b/public/scripts/slash-commands/SlashCommand.js @@ -1,5 +1,25 @@ +import { SlashCommandAbortController } from './SlashCommandAbortController.js'; import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandArgument.js'; import { SlashCommandClosure } from './SlashCommandClosure.js'; +import { PARSER_FLAG } from './SlashCommandParser.js'; +import { SlashCommandScope } from './SlashCommandScope.js'; + + + + +/** + * @typedef {{ + * _pipe:string|SlashCommandClosure, + * _scope:SlashCommandScope, + * _parserFlags:{[id:PARSER_FLAG]:boolean}, + * _abortController:SlashCommandAbortController, + * [id:string]:string, + * }} NamedArguments + */ + +/** + * @typedef {string|SlashCommandClosure|(string|SlashCommandClosure)[]} UnnamedArguments +*/ @@ -8,7 +28,7 @@ export class SlashCommand { * Creates a SlashCommand from a properties object. * @param {Object} props * @param {string} [props.name] - * @param {(namedArguments:Object., unnamedArguments:string|SlashCommandClosure|(string|SlashCommandClosure)[])=>string|SlashCommandClosure|void|Promise} [props.callback] + * @param {(namedArguments:NamedArguments, unnamedArguments:string|SlashCommandClosure|(string|SlashCommandClosure)[])=>string|SlashCommandClosure|void|Promise} [props.callback] * @param {string} [props.helpString] * @param {boolean} [props.splitUnnamedArgument] * @param {string[]} [props.aliases] @@ -25,7 +45,7 @@ export class SlashCommand { /**@type {string}*/ name; - /**@type {(namedArguments:Object, unnamedArguments:string|SlashCommandClosure|(string|SlashCommandClosure)[])=>string|SlashCommandClosure|Promise}*/ callback; + /**@type {(namedArguments:{_pipe:string|SlashCommandClosure, _scope:SlashCommandScope, _abortController:SlashCommandAbortController, [id:string]:string|SlashCommandClosure}, unnamedArguments:string|SlashCommandClosure|(string|SlashCommandClosure)[])=>string|SlashCommandClosure|Promise}*/ callback; /**@type {string}*/ helpString; /**@type {boolean}*/ splitUnnamedArgument = false; /**@type {string[]}*/ aliases = []; diff --git a/public/scripts/slash-commands/SlashCommandExecutor.js b/public/scripts/slash-commands/SlashCommandExecutor.js index 2cf0c4647..f64c37aff 100644 --- a/public/scripts/slash-commands/SlashCommandExecutor.js +++ b/public/scripts/slash-commands/SlashCommandExecutor.js @@ -20,7 +20,7 @@ export class SlashCommandExecutor { // @ts-ignore /**@type {SlashCommandNamedArgumentAssignment[]}*/ namedArgumentList = []; /**@type {SlashCommandUnnamedArgumentAssignment[]}*/ unnamedArgumentList = []; - /**@type {Object} */ parserFlags; + /**@type {{[id:PARSER_FLAG]:boolean}} */ parserFlags; get commandCount() { return 1