mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
add /qr-arg for {{arg::...}} fallbacks
This commit is contained in:
@ -526,6 +526,34 @@ export class SlashCommandHandler {
|
|||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-arg',
|
||||||
|
callback: ({ _scope }, [key, value]) => {
|
||||||
|
_scope.setMacro(`arg::${key}`, value, false);
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
unnamedArgumentList: [
|
||||||
|
SlashCommandArgument.fromProps({ description: 'argument name',
|
||||||
|
typeList: ARGUMENT_TYPE.STRING,
|
||||||
|
isRequired: true,
|
||||||
|
}),
|
||||||
|
SlashCommandArgument.fromProps({ description: 'argument value',
|
||||||
|
typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.BOOLEAN, ARGUMENT_TYPE.LIST, ARGUMENT_TYPE.DICTIONARY],
|
||||||
|
isRequired: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
splitUnnamedArgument: true,
|
||||||
|
splitUnnamedArgumentCount: 2,
|
||||||
|
helpString: `
|
||||||
|
<div>
|
||||||
|
Set a fallback value for a Quick Reply argument.
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>Example:</strong>
|
||||||
|
<pre><code>/qr-arg x foo |\n/echo {{arg::x}}</code></pre>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user