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:
@@ -792,6 +792,8 @@ async function setSpriteSlashCommand({ type }, searchTerm) {
|
|||||||
function setFallBackExpressionSlashCommand(args, expressionName) {
|
function setFallBackExpressionSlashCommand(args, expressionName) {
|
||||||
expressionName = expressionName.trim().toLowerCase();
|
expressionName = expressionName.trim().toLowerCase();
|
||||||
|
|
||||||
|
if (!expressionName) return extension_settings?.expressions?.fallback_expression || '';
|
||||||
|
|
||||||
const select = /** @type {HTMLSelectElement} */(document.getElementById('expression_fallback'));
|
const select = /** @type {HTMLSelectElement} */(document.getElementById('expression_fallback'));
|
||||||
const fallbackExpressions = Array
|
const fallbackExpressions = Array
|
||||||
.from(select?.options || [])
|
.from(select?.options || [])
|
||||||
@@ -2341,13 +2343,13 @@ export async function init() {
|
|||||||
returns: 'The currently set expression label after setting it.',
|
returns: 'The currently set expression label after setting it.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'expression-set-fallback',
|
name: 'expression-fallback',
|
||||||
callback: setFallBackExpressionSlashCommand,
|
callback: setFallBackExpressionSlashCommand,
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
SlashCommandArgument.fromProps({
|
SlashCommandArgument.fromProps({
|
||||||
description: 'expression label to set',
|
description: 'expression label to set',
|
||||||
typeList: [ARGUMENT_TYPE.STRING],
|
typeList: [ARGUMENT_TYPE.STRING],
|
||||||
isRequired: true,
|
isRequired: false,
|
||||||
enumProvider: () => [
|
enumProvider: () => [
|
||||||
new SlashCommandEnumValue('#none', 'Sets the fallback expression to no image'),
|
new SlashCommandEnumValue('#none', 'Sets the fallback expression to no image'),
|
||||||
new SlashCommandEnumValue('#emoji', 'Sets the fallback expression to emojis'),
|
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.',
|
returns: 'The currently set expression label after setting it.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
|
|||||||
Reference in New Issue
Block a user