Add /classify-expressions to retrieve emote list

This commit is contained in:
Wolfsblvt
2024-09-05 00:24:10 +02:00
parent 2472b26057
commit 3b10ae00c7

View File

@ -1354,7 +1354,7 @@ function getCachedExpressions() {
return [...expressionsList, ...extension_settings.expressions.custom].filter(onlyUnique); return [...expressionsList, ...extension_settings.expressions.custom].filter(onlyUnique);
} }
async function getExpressionsList() { export async function getExpressionsList() {
// Return cached list if available // Return cached list if available
if (Array.isArray(expressionsList)) { if (Array.isArray(expressionsList)) {
return getCachedExpressions(); return getCachedExpressions();
@ -2085,7 +2085,7 @@ function migrateSettings() {
}), }),
], ],
helpString: 'Force sets the sprite for the current character.', helpString: 'Force sets the sprite for the current character.',
returns: 'label', returns: 'the currently set sprite label after setting it.',
})); }));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'spriteoverride', name: 'spriteoverride',
@ -2101,7 +2101,7 @@ function migrateSettings() {
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'lastsprite', name: 'lastsprite',
callback: (_, value) => lastExpression[String(value).trim()] ?? '', callback: (_, value) => lastExpression[String(value).trim()] ?? '',
returns: 'sprite', returns: 'the last set sprite / expression for the named character.',
unnamedArgumentList: [ unnamedArgumentList: [
SlashCommandArgument.fromProps({ SlashCommandArgument.fromProps({
description: 'character name', description: 'character name',
@ -2117,7 +2117,14 @@ function migrateSettings() {
callback: toggleTalkingHeadCommand, callback: toggleTalkingHeadCommand,
aliases: ['talkinghead'], aliases: ['talkinghead'],
helpString: 'Character Expressions: toggles <i>Image Type - talkinghead (extras)</i> on/off.', helpString: 'Character Expressions: toggles <i>Image Type - talkinghead (extras)</i> on/off.',
returns: ARGUMENT_TYPE.BOOLEAN, returns: 'the current state of the <i>Image Type - talkinghead (extras)</i> on/off.',
}));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'classify-expressions',
aliases: ['expressions'],
callback: async () => (await getExpressionsList()).join(', '),
returns: 'The comma-separated list of available expressions, including custom expressions.',
helpString: 'Returns a list of available expressions, including custom expressions.',
})); }));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'classify', name: 'classify',