diff --git a/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js b/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js index c6876482b..8604ba27f 100644 --- a/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js +++ b/public/scripts/slash-commands/SlashCommandCommonEnumsProvider.js @@ -6,7 +6,9 @@ import { searchCharByName, getTagsList, tags } from '../tags.js'; import { world_names } from '../world-info.js'; import { SlashCommandClosure } from './SlashCommandClosure.js'; import { SlashCommandEnumValue, enumTypes } from './SlashCommandEnumValue.js'; -import { SlashCommandScope } from "./SlashCommandScope.js"; + +/** @typedef {import('./SlashCommandExecutor.js').SlashCommandExecutor} SlashCommandExecutor */ +/** @typedef {import('./SlashCommandScope.js').SlashCommandScope} SlashCommandScope */ /** * A collection of regularly used enum icons @@ -140,7 +142,7 @@ export const commonEnumProviders = { * @param {...('global'|'local'|'scope'|'all')} type - The type of variables to include in the array. Can be 'all', 'global', or 'local'. * @returns {(executor:SlashCommandExecutor, scope:SlashCommandScope) => SlashCommandEnumValue[]} */ - variables: (...type) => (executor, scope) => { + variables: (...type) => (_, scope) => { const types = type.flat(); const isAll = types.includes('all'); return [ @@ -184,7 +186,7 @@ export const commonEnumProviders = { * @param {('all' | 'existing' | 'not-existing')?} [mode='all'] - Which types of tags to show * @returns {() => SlashCommandEnumValue[]} */ - tagsForChar: (mode = 'all') => (/** @type {import('./SlashCommandExecutor.js').SlashCommandExecutor} */ executor) => { + tagsForChar: (mode = 'all') => (/** @type {SlashCommandExecutor} */ executor) => { // Try to see if we can find the char during execution to filter down the tags list some more. Otherwise take all tags. const charName = executor.namedArgumentList.find(it => it.name == 'name')?.value; if (charName instanceof SlashCommandClosure) throw new Error('Argument \'name\' does not support closures'); @@ -202,13 +204,13 @@ export const commonEnumProviders = { * @param {object} [options={}] - Optional arguments * @param {boolean} [options.allowIdAfter=false] - Whether to add an enum option for the new message id after the last message * @param {boolean} [options.allowVars=false] - Whether to add enum option for variable names - * @returns {() => SlashCommandEnumValue[]} + * @returns {(executor:SlashCommandExecutor, scope:SlashCommandScope) => SlashCommandEnumValue[]} */ - messages: ({ allowIdAfter = false, allowVars = false } = {}) => () => { + messages: ({ allowIdAfter = false, allowVars = false } = {}) => (_, scope) => { return [ ...chat.map((message, index) => new SlashCommandEnumValue(String(index), `${message.name}: ${message.mes}`, enumTypes.number, message.is_user ? enumIcons.user : message.is_system ? enumIcons.system : enumIcons.assistant)), ...allowIdAfter ? [new SlashCommandEnumValue(String(chat.length), '>> After Last Message >>', enumTypes.enum, '➕')] : [], - ...allowVars ? commonEnumProviders.variables('all')() : [], + ...allowVars ? commonEnumProviders.variables('all')(_, scope) : [], ]; },