Add scroll option to /chat-render command

b60458863849fa64ec6e905d60bc63a8b782511c

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +13 -1Ignore whitespace
public/scripts/slash-commands.js+13 -1
@@ -1968,10 +1968,22 @@ export function initDefaultSlashCommands() {
19681968 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
19691969 name: 'chat-render',
19701970 helpString: 'Renders a specified number of messages into the chat window. Displays all messages if no argument is provided.',
19711971 callback: (_args, number) => {
19721972 showMoreMessages(number && !isNaN(Number(number)) ? Number(number) : Number.MAX_SAFE_INTEGER);
1973+ if (isTrueBoolean(String(args?.scroll ?? ''))) {
1974+ $('#chat').scrollTop(0);
1975+ }
19731976 return '';
19741977 },
1978+ namedArgumentList: [
1979+ SlashCommandNamedArgument.fromProps({
1980+ name: 'scroll',
1981+ description: 'scroll to the top after rendering',
1982+ typeList: [ARGUMENT_TYPE.BOOLEAN],
1983+ defaultValue: 'false',
1984+ enumList: commonEnumProviders.boolean('trueFalse')(),
1985+ }),
1986+ ],
19751987 unnamedArgumentList: [
19761988 new SlashCommandArgument(
19771989 'number of messages', [ARGUMENT_TYPE.NUMBER], false,