mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
fix /? slash
This commit is contained in:
@ -5,4 +5,17 @@ export class SlashCommand {
|
|||||||
/**@type {Boolean}*/ interruptsGeneration;
|
/**@type {Boolean}*/ interruptsGeneration;
|
||||||
/**@type {Boolean}*/ purgeFromMessage;
|
/**@type {Boolean}*/ purgeFromMessage;
|
||||||
/**@type {String[]}*/ aliases;
|
/**@type {String[]}*/ aliases;
|
||||||
|
|
||||||
|
get helpStringFormatted() {
|
||||||
|
let aliases = '';
|
||||||
|
if (this.aliases?.length > 0) {
|
||||||
|
aliases = ' (alias: ';
|
||||||
|
aliases += this.aliases
|
||||||
|
.map(it=>`<span class="monospace">/${it}</span>`)
|
||||||
|
.join(', ')
|
||||||
|
;
|
||||||
|
aliases += ')';
|
||||||
|
}
|
||||||
|
return `<span class="monospace">/${this.name}</span>${this.helpString}${aliases}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,9 +154,11 @@ export class SlashCommandParser {
|
|||||||
|
|
||||||
getHelpString() {
|
getHelpString() {
|
||||||
const listItems = Object
|
const listItems = Object
|
||||||
.entries(this.helpStrings)
|
.keys(this.commands)
|
||||||
.sort((a, b) => a[0].localeCompare(b[0]))
|
.filter(key=>this.commands[key].name == key)
|
||||||
.map(x => x[1])
|
.map(key=>this.commands[key])
|
||||||
|
.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()))
|
||||||
|
.map(x => x.helpStringFormatted)
|
||||||
.map(x => `<li>${x}</li>`)
|
.map(x => `<li>${x}</li>`)
|
||||||
.join('\n');
|
.join('\n');
|
||||||
return `<p>Slash commands:</p><ol>${listItems}</ol>
|
return `<p>Slash commands:</p><ol>${listItems}</ol>
|
||||||
|
Reference in New Issue
Block a user