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

91c40280ed59ec43503a2645f6fd1c43f301099d

Leandro Jofré <leandrotomasjofre@gmail.com>

Signed
1 files changed, +23 -3Ignore whitespace
public/scripts/extensions/expressions/index.js+23 -3
@@ -792,6 +792,8 @@ async function setSpriteSlashCommand({ type }, searchTerm) {
792792function setFallBackExpressionSlashCommand(args, expressionName) {
793793 expressionName = expressionName.trim().toLowerCase();
794794
795+ if (!expressionName) return extension_settings?.expressions?.fallback_expression || '';
796+
795797 const select = /** @type {HTMLSelectElement} */(document.getElementById('expression_fallback'));
796798 const fallbackExpressions = Array
797799 .from(select?.options || [])
@@ -2341,13 +2343,13 @@ export async function init() {
23412343 returns: 'The currently set expression label after setting it.',
23422344 }));
23432345 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
23442346 name: 'expression-set-fallback',
23452347 callback: setFallBackExpressionSlashCommand,
23462348 unnamedArgumentList: [
23472349 SlashCommandArgument.fromProps({
23482350 description: 'expression label to set',
23492351 typeList: [ARGUMENT_TYPE.STRING],
23502352 isRequired: truefalse,
23512353 enumProvider: () => [
23522354 new SlashCommandEnumValue('#none', 'Sets the fallback expression to no image'),
23532355 new SlashCommandEnumValue('#emoji', 'Sets the fallback expression to emojis'),
@@ -2355,7 +2357,25 @@ export async function init() {
23552357 ],
23562358 }),
23572359 ],
2358- helpString: 'Force sets the expression fallback for all characters.',
2360+ helpString: `
2361+ <div>
2362+ Gets the currently selected expression fallback for all characters.<br />
2363+ If a valid expression label is sent, it will be set as the new fallback.
2364+ </div>
2365+ <div>
2366+ <strong>Example:</strong>
2367+ <ul>
2368+ <li>
2369+ <pre><code>/expression-fallback | /echo</code></pre>
2370+ <small>Returns the currently selected fallback.</small>
2371+ </li>
2372+ <li>
2373+ <pre><code>/expression-fallback admiration</code></pre>
2374+ <small>Sets a new expression as fallback.</small>
2375+ </li>
2376+ </ul>
2377+ </div>
2378+ `,
23592379 returns: 'The currently set expression label after setting it.',
23602380 }));
23612381 SlashCommandParser.addCommandObject(SlashCommand.fromProps({