Update /ask with return types, defaulting 'pipe'

e3c0c5442c1646970802cb1243bb9e39279d28be

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +12 -2Ignore whitespace
public/scripts/slash-commands.js+12 -2
@@ -456,7 +456,7 @@ export function initDefaultSlashCommands() {
456 SlashCommandParser.addCommandObject(SlashCommand.fromProps({456 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
457 name: 'ask',457 name: 'ask',
458 callback: askCharacter,458 callback: askCharacter,
459 returns: 'the generated text',459 returns: 'Optionally the text of the sent message, if specified in the "return" argument',
460 namedArgumentList: [460 namedArgumentList: [
461 SlashCommandNamedArgument.fromProps({461 SlashCommandNamedArgument.fromProps({
462 name: 'name',462 name: 'name',
@@ -465,6 +465,14 @@ export function initDefaultSlashCommands() {
465 isRequired: true,465 isRequired: true,
466 enumProvider: commonEnumProviders.characters('character'),466 enumProvider: commonEnumProviders.characters('character'),
467 }),467 }),
468 SlashCommandNamedArgument.fromProps({
469 name: 'return',
470 description: 'The way how you want the return value to be provided',
471 typeList: [ARGUMENT_TYPE.STRING],
472 defaultValue: 'pipe',
473 enumList: slashCommandReturnHelper.enumList({ allowObject: true }),
474 forceEnum: true,
475 }),
468 ],476 ],
469 unnamedArgumentList: [477 unnamedArgumentList: [
470 new SlashCommandArgument(478 new SlashCommandArgument(
@@ -2594,7 +2602,9 @@ async function askCharacter(args, text) {
2594 }2602 }
2595 }2603 }
25962604
2597 return askResult;2605 const message = askResult ? chat[chat.length - 1] : null;
2606
2607 return await slashCommandReturnHelper.doReturn(args.return ?? 'pipe', message, { objectToStringFunc: x => x.mes });
2598}2608}
25992609
2600async function hideMessageCallback(_, arg) {2610async function hideMessageCallback(_, arg) {