Fix lint issues in enum providers
| @@ -6,7 +6,9 @@ import { searchCharByName, getTagsList, tags } from '../tags.js'; | ||
| 6 | 6 | import { world_names } from '../world-info.js'; |
| 7 | 7 | import { SlashCommandClosure } from './SlashCommandClosure.js'; |
| 8 | 8 | import { SlashCommandEnumValue, enumTypes } from './SlashCommandEnumValue.js'; |
| 9 | -import { SlashCommandScope } from "./SlashCommandScope.js"; | |
| 9 | + | |
| 10 | +/** @typedef {import('./SlashCommandExecutor.js').SlashCommandExecutor} SlashCommandExecutor */ | |
| 11 | +/** @typedef {import('./SlashCommandScope.js').SlashCommandScope} SlashCommandScope */ | |
| 10 | 12 | |
| 11 | 13 | /** |
| 12 | 14 | * A collection of regularly used enum icons |
| @@ -140,7 +142,7 @@ export const commonEnumProviders = { | ||
| 140 | 142 | * @param {...('global'|'local'|'scope'|'all')} type - The type of variables to include in the array. Can be 'all', 'global', or 'local'. |
| 141 | 143 | * @returns {(executor:SlashCommandExecutor, scope:SlashCommandScope) => SlashCommandEnumValue[]} |
| 142 | 144 | */ |
| 143 | 145 | variables: (...type) => (executor_, scope) => { |
| 144 | 146 | const types = type.flat(); |
| 145 | 147 | const isAll = types.includes('all'); |
| 146 | 148 | return [ |
| @@ -184,7 +186,7 @@ export const commonEnumProviders = { | ||
| 184 | 186 | * @param {('all' | 'existing' | 'not-existing')?} [mode='all'] - Which types of tags to show |
| 185 | 187 | * @returns {() => SlashCommandEnumValue[]} |
| 186 | 188 | */ |
| 187 | 189 | tagsForChar: (mode = 'all') => (/** @type {import('./SlashCommandExecutor.js').SlashCommandExecutor} */ executor) => { |
| 188 | 190 | // Try to see if we can find the char during execution to filter down the tags list some more. Otherwise take all tags. |
| 189 | 191 | const charName = executor.namedArgumentList.find(it => it.name == 'name')?.value; |
| 190 | 192 | if (charName instanceof SlashCommandClosure) throw new Error('Argument \'name\' does not support closures'); |
| @@ -202,13 +204,13 @@ export const commonEnumProviders = { | ||
| 202 | 204 | * @param {object} [options={}] - Optional arguments |
| 203 | 205 | * @param {boolean} [options.allowIdAfter=false] - Whether to add an enum option for the new message id after the last message |
| 204 | 206 | * @param {boolean} [options.allowVars=false] - Whether to add enum option for variable names |
| 205 | 207 | * @returns {(executor:SlashCommandExecutor, scope:SlashCommandScope) => SlashCommandEnumValue[]} |
| 206 | 208 | */ |
| 207 | 209 | messages: ({ allowIdAfter = false, allowVars = false } = {}) => (_, scope) => { |
| 208 | 210 | return [ |
| 209 | 211 | ...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)), |
| 210 | 212 | ...allowIdAfter ? [new SlashCommandEnumValue(String(chat.length), '>> After Last Message >>', enumTypes.enum, '➕')] : [], |
| 211 | 213 | ...allowVars ? commonEnumProviders.variables('all')(_, scope) : [], |
| 212 | 214 | ]; |
| 213 | 215 | }, |
| 214 | 216 | |