Merge pull request #2435 from SillyTavern/remove-var-from-at-arg Remove variable usage of 'at' arg in send commands

a287ccfca268aae06d7c1e4a0cf38ddf8e320c9c

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

Signed
1 files changed, +12 -12Ignore whitespace
public/scripts/slash-commands.js+12 -12
@@ -178,8 +178,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
178 SlashCommandNamedArgument.fromProps({178 SlashCommandNamedArgument.fromProps({
179 name: 'at',179 name: 'at',
180 description: 'position to insert the message',180 description: 'position to insert the message',
181 typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.VARIABLE_NAME],181 typeList: [ARGUMENT_TYPE.NUMBER],
182 enumProvider: commonEnumProviders.messages({ allowIdAfter: true, allowVars: true }),182 enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
183 }),183 }),
184 ],184 ],
185 unnamedArgumentList: [185 unnamedArgumentList: [
@@ -221,8 +221,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
221 SlashCommandNamedArgument.fromProps({221 SlashCommandNamedArgument.fromProps({
222 name: 'at',222 name: 'at',
223 description: 'position to insert the message',223 description: 'position to insert the message',
224 typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.VARIABLE_NAME],224 typeList: [ARGUMENT_TYPE.NUMBER],
225 enumProvider: commonEnumProviders.messages({ allowIdAfter: true, allowVars: true }),225 enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
226 }),226 }),
227 ],227 ],
228 unnamedArgumentList: [228 unnamedArgumentList: [
@@ -275,8 +275,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
275 SlashCommandNamedArgument.fromProps({275 SlashCommandNamedArgument.fromProps({
276 name: 'at',276 name: 'at',
277 description: 'position to insert the message',277 description: 'position to insert the message',
278 typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.VARIABLE_NAME],278 typeList: [ARGUMENT_TYPE.NUMBER],
279 enumProvider: commonEnumProviders.messages({ allowIdAfter: true, allowVars: true }),279 enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
280 }),280 }),
281 ],281 ],
282 unnamedArgumentList: [282 unnamedArgumentList: [
@@ -460,8 +460,8 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
460 SlashCommandNamedArgument.fromProps({460 SlashCommandNamedArgument.fromProps({
461 name: 'at',461 name: 'at',
462 description: 'position to insert the message',462 description: 'position to insert the message',
463 typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.VARIABLE_NAME],463 typeList: [ARGUMENT_TYPE.NUMBER],
464 enumProvider: commonEnumProviders.messages({ allowIdAfter: true, allowVars: true }),464 enumProvider: commonEnumProviders.messages({ allowIdAfter: true }),
465 }),465 }),
466 SlashCommandNamedArgument.fromProps({466 SlashCommandNamedArgument.fromProps({
467 name: 'name',467 name: 'name',
@@ -2428,7 +2428,7 @@ async function sendUserMessageCallback(args, text) {
2428 text = text.trim();2428 text = text.trim();
2429 const compact = isTrueBoolean(args?.compact);2429 const compact = isTrueBoolean(args?.compact);
2430 const bias = extractMessageBias(text);2430 const bias = extractMessageBias(text);
2431 const insertAt = Number(resolveVariable(args?.at));2431 const insertAt = Number(args?.at);
24322432
2433 if ('name' in args) {2433 if ('name' in args) {
2434 const name = args.name || '';2434 const name = args.name || '';
@@ -2737,7 +2737,7 @@ export async function sendMessageAs(args, text) {
2737 },2737 },
2738 }];2738 }];
27392739
2740 const insertAt = Number(resolveVariable(args.at));2740 const insertAt = Number(args.at);
27412741
2742 if (!isNaN(insertAt) && insertAt >= 0 && insertAt <= chat.length) {2742 if (!isNaN(insertAt) && insertAt >= 0 && insertAt <= chat.length) {
2743 chat.splice(insertAt, 0, message);2743 chat.splice(insertAt, 0, message);
@@ -2784,7 +2784,7 @@ export async function sendNarratorMessage(args, text) {
2784 },2784 },
2785 };2785 };
27862786
2787 const insertAt = Number(resolveVariable(args.at));2787 const insertAt = Number(args.at);
27882788
2789 if (!isNaN(insertAt) && insertAt >= 0 && insertAt <= chat.length) {2789 if (!isNaN(insertAt) && insertAt >= 0 && insertAt <= chat.length) {
2790 chat.splice(insertAt, 0, message);2790 chat.splice(insertAt, 0, message);
@@ -2866,7 +2866,7 @@ async function sendCommentMessage(args, text) {
2866 },2866 },
2867 };2867 };
28682868
2869 const insertAt = Number(resolveVariable(args.at));2869 const insertAt = Number(args.at);
28702870
2871 if (!isNaN(insertAt) && insertAt >= 0 && insertAt <= chat.length) {2871 if (!isNaN(insertAt) && insertAt >= 0 && insertAt <= chat.length) {
2872 chat.splice(insertAt, 0, message);2872 chat.splice(insertAt, 0, message);