Update /ask with return types, defaulting 'pipe'
This commit is contained in:
parent
d8379edee7
commit
e3c0c5442c
|
@ -456,7 +456,7 @@ export function initDefaultSlashCommands() {
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'ask',
|
name: 'ask',
|
||||||
callback: askCharacter,
|
callback: askCharacter,
|
||||||
returns: 'the generated text',
|
returns: 'Optionally the text of the sent message, if specified in the "return" argument',
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
name: 'name',
|
name: 'name',
|
||||||
|
@ -465,6 +465,14 @@ export function initDefaultSlashCommands() {
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
enumProvider: commonEnumProviders.characters('character'),
|
enumProvider: commonEnumProviders.characters('character'),
|
||||||
}),
|
}),
|
||||||
|
SlashCommandNamedArgument.fromProps({
|
||||||
|
name: 'return',
|
||||||
|
description: 'The way how you want the return value to be provided',
|
||||||
|
typeList: [ARGUMENT_TYPE.STRING],
|
||||||
|
defaultValue: 'pipe',
|
||||||
|
enumList: slashCommandReturnHelper.enumList({ allowObject: true }),
|
||||||
|
forceEnum: true,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
new SlashCommandArgument(
|
new SlashCommandArgument(
|
||||||
|
@ -2594,7 +2602,9 @@ async function askCharacter(args, text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return askResult;
|
const message = askResult ? chat[chat.length - 1] : null;
|
||||||
|
|
||||||
|
return await slashCommandReturnHelper.doReturn(args.return ?? 'pipe', message, { objectToStringFunc: x => x.mes });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function hideMessageCallback(_, arg) {
|
async function hideMessageCallback(_, arg) {
|
||||||
|
|
Loading…
Reference in New Issue