From f317b1b764eb5013fd3d88defd91f5165890a58a Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 1 Oct 2024 00:41:14 +0200 Subject: [PATCH] Oversight, missed /send in refactoring... --- public/scripts/slash-commands.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 85744fdd8..d1ab9523e 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -511,7 +511,7 @@ export function initDefaultSlashCommands() { SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'send', callback: sendUserMessageCallback, - returns: 'The text of the sent message', + returns: 'Optionally the text of the sent message, if specified in the "return" argument', namedArgumentList: [ new SlashCommandNamedArgument( 'compact', @@ -534,6 +534,14 @@ export function initDefaultSlashCommands() { defaultValue: '{{user}}', enumProvider: commonEnumProviders.personas, }), + SlashCommandNamedArgument.fromProps({ + name: 'return', + description: 'The way how you want the return value to be provided', + typeList: [ARGUMENT_TYPE.STRING], + defaultValue: 'none', + enumList: slashCommandReturnHelper.enumList({ allowObject: true }), + forceEnum: true, + }), ], unnamedArgumentList: [ new SlashCommandArgument( @@ -2923,7 +2931,7 @@ async function sendUserMessageCallback(args, text) { message = await sendMessageAsUser(text, bias, insertAt, compact); } - return message.mes; + return await slashCommandReturnHelper.doReturn(args.return ?? 'none', message, { objectToStringFunc: x => x.mes }); } async function deleteMessagesByNameCallback(_, name) {