mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #2540 from Succubyss/chatvar
Adds "chatvar" aliases & "length" alias
This commit is contained in:
@@ -95,6 +95,7 @@ export function initDefaultSlashCommands() {
|
|||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'persona',
|
name: 'persona',
|
||||||
callback: setNameCallback,
|
callback: setNameCallback,
|
||||||
|
aliases: ['name'],
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
new SlashCommandNamedArgument(
|
new SlashCommandNamedArgument(
|
||||||
'mode', 'The mode for persona selection. ("lookup" = search for existing persona, "temp" = create a temporary name, set a temporary name, "all" = allow both in the same command)',
|
'mode', 'The mode for persona selection. ("lookup" = search for existing persona, "temp" = create a temporary name, set a temporary name, "all" = allow both in the same command)',
|
||||||
@@ -110,7 +111,6 @@ export function initDefaultSlashCommands() {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
helpString: 'Selects the given persona with its name and avatar (by name or avatar url). If no matching persona exists, applies a temporary name.',
|
helpString: 'Selects the given persona with its name and avatar (by name or avatar url). If no matching persona exists, applies a temporary name.',
|
||||||
aliases: ['name'],
|
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'sync',
|
name: 'sync',
|
||||||
|
@@ -859,11 +859,13 @@ export function registerVariableCommands() {
|
|||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'listvar',
|
name: 'listvar',
|
||||||
callback: listVariablesCallback,
|
callback: listVariablesCallback,
|
||||||
|
aliases: ['listchatvar'],
|
||||||
helpString: 'List registered chat variables.',
|
helpString: 'List registered chat variables.',
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'setvar',
|
name: 'setvar',
|
||||||
callback: (args, value) => String(setLocalVariable(args.key || args.name, value, args)),
|
callback: (args, value) => String(setLocalVariable(args.key || args.name, value, args)),
|
||||||
|
aliases: ['setchatvar'],
|
||||||
returns: 'the set variable value',
|
returns: 'the set variable value',
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
@@ -900,6 +902,7 @@ export function registerVariableCommands() {
|
|||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'getvar',
|
name: 'getvar',
|
||||||
callback: (args, value) => String(getLocalVariable(value, args)),
|
callback: (args, value) => String(getLocalVariable(value, args)),
|
||||||
|
aliases: ['getchatvar'],
|
||||||
returns: 'the variable value',
|
returns: 'the variable value',
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
@@ -943,6 +946,7 @@ export function registerVariableCommands() {
|
|||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'addvar',
|
name: 'addvar',
|
||||||
callback: (args, value) => String(addLocalVariable(args.key || args.name, value)),
|
callback: (args, value) => String(addLocalVariable(args.key || args.name, value)),
|
||||||
|
aliases: ['addchatvar'],
|
||||||
returns: 'the new variable value',
|
returns: 'the new variable value',
|
||||||
namedArgumentList: [
|
namedArgumentList: [
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
@@ -1087,6 +1091,7 @@ export function registerVariableCommands() {
|
|||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'incvar',
|
name: 'incvar',
|
||||||
callback: (_, value) => String(incrementLocalVariable(value)),
|
callback: (_, value) => String(incrementLocalVariable(value)),
|
||||||
|
aliases: ['incchatvar'],
|
||||||
returns: 'the new variable value',
|
returns: 'the new variable value',
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
@@ -1115,6 +1120,7 @@ export function registerVariableCommands() {
|
|||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'decvar',
|
name: 'decvar',
|
||||||
callback: (_, value) => String(decrementLocalVariable(value)),
|
callback: (_, value) => String(decrementLocalVariable(value)),
|
||||||
|
aliases: ['decchatvar'],
|
||||||
returns: 'the new variable value',
|
returns: 'the new variable value',
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
@@ -1401,6 +1407,7 @@ export function registerVariableCommands() {
|
|||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'flushvar',
|
name: 'flushvar',
|
||||||
callback: async (_, value) => deleteLocalVariable(value instanceof SlashCommandClosure ? (await value.execute())?.pipe : String(value)),
|
callback: async (_, value) => deleteLocalVariable(value instanceof SlashCommandClosure ? (await value.execute())?.pipe : String(value)),
|
||||||
|
aliases: ['flushchatvar'],
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
name: 'key',
|
name: 'key',
|
||||||
@@ -1870,6 +1877,7 @@ export function registerVariableCommands() {
|
|||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'len',
|
name: 'len',
|
||||||
callback: (_, value) => String(lenValuesCallback(value)),
|
callback: (_, value) => String(lenValuesCallback(value)),
|
||||||
|
aliases: ['length'],
|
||||||
returns: 'length of the provided value',
|
returns: 'length of the provided value',
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
SlashCommandArgument.fromProps({
|
SlashCommandArgument.fromProps({
|
||||||
|
Reference in New Issue
Block a user