Update/Turn expression-set-fallback into expression-fallback (#5564)

* Update - Turn expression-set-fallback into expression-fallback
Make the extension a getter and setter instead of a setter only.

* Update - Rewrite the help string and add usage examples

* Fix - Remove the alias
This commit is contained in:
Leandro Jofré
2026-05-01 11:04:49 -03:00
committed by GitHub
parent b2fa6a0afb
commit 91c40280ed
+23 -3
View File
@@ -792,6 +792,8 @@ async function setSpriteSlashCommand({ type }, searchTerm) {
function setFallBackExpressionSlashCommand(args, expressionName) {
expressionName = expressionName.trim().toLowerCase();
if (!expressionName) return extension_settings?.expressions?.fallback_expression || '';
const select = /** @type {HTMLSelectElement} */(document.getElementById('expression_fallback'));
const fallbackExpressions = Array
.from(select?.options || [])
@@ -2341,13 +2343,13 @@ export async function init() {
returns: 'The currently set expression label after setting it.',
}));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'expression-set-fallback',
name: 'expression-fallback',
callback: setFallBackExpressionSlashCommand,
unnamedArgumentList: [
SlashCommandArgument.fromProps({
description: 'expression label to set',
typeList: [ARGUMENT_TYPE.STRING],
isRequired: true,
isRequired: false,
enumProvider: () => [
new SlashCommandEnumValue('#none', 'Sets the fallback expression to no image'),
new SlashCommandEnumValue('#emoji', 'Sets the fallback expression to emojis'),
@@ -2355,7 +2357,25 @@ export async function init() {
],
}),
],
helpString: 'Force sets the expression fallback for all characters.',
helpString: `
<div>
Gets the currently selected expression fallback for all characters.<br />
If a valid expression label is sent, it will be set as the new fallback.
</div>
<div>
<strong>Example:</strong>
<ul>
<li>
<pre><code>/expression-fallback | /echo</code></pre>
<small>Returns the currently selected fallback.</small>
</li>
<li>
<pre><code>/expression-fallback admiration</code></pre>
<small>Sets a new expression as fallback.</small>
</li>
</ul>
</div>
`,
returns: 'The currently set expression label after setting it.',
}));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({