Merge pull request #2540 from Succubyss/chatvar Adds "chatvar" aliases & "length" alias
Signed| @@ -95,6 +95,7 @@ export function initDefaultSlashCommands() { | |||
| 95 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 95 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 96 | name: 'persona', | 96 | name: 'persona', |
| 97 | callback: setNameCallback, | 97 | callback: setNameCallback, |
| 98 | aliases: ['name'], | ||
| 98 | namedArgumentList: [ | 99 | namedArgumentList: [ |
| 99 | new SlashCommandNamedArgument( | 100 | new SlashCommandNamedArgument( |
| 100 | '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)', | 101 | '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() { | |||
| 110 | }), | 111 | }), |
| 111 | ], | 112 | ], |
| 112 | helpString: 'Selects the given persona with its name and avatar (by name or avatar url). If no matching persona exists, applies a temporary name.', | 113 | helpString: 'Selects the given persona with its name and avatar (by name or avatar url). If no matching persona exists, applies a temporary name.', |
| 113 | aliases: ['name'], | ||
| 114 | })); | 114 | })); |
| 115 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 115 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 116 | name: 'sync', | 116 | name: 'sync', |
| @@ -859,11 +859,13 @@ export function registerVariableCommands() { | |||
| 859 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 859 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 860 | name: 'listvar', | 860 | name: 'listvar', |
| 861 | callback: listVariablesCallback, | 861 | callback: listVariablesCallback, |
| 862 | aliases: ['listchatvar'], | ||
| 862 | helpString: 'List registered chat variables.', | 863 | helpString: 'List registered chat variables.', |
| 863 | })); | 864 | })); |
| 864 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 865 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 865 | name: 'setvar', | 866 | name: 'setvar', |
| 866 | callback: (args, value) => String(setLocalVariable(args.key || args.name, value, args)), | 867 | callback: (args, value) => String(setLocalVariable(args.key || args.name, value, args)), |
| 868 | aliases: ['setchatvar'], | ||
| 867 | returns: 'the set variable value', | 869 | returns: 'the set variable value', |
| 868 | namedArgumentList: [ | 870 | namedArgumentList: [ |
| 869 | SlashCommandNamedArgument.fromProps({ | 871 | SlashCommandNamedArgument.fromProps({ |
| @@ -900,6 +902,7 @@ export function registerVariableCommands() { | |||
| 900 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 902 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 901 | name: 'getvar', | 903 | name: 'getvar', |
| 902 | callback: (args, value) => String(getLocalVariable(value, args)), | 904 | callback: (args, value) => String(getLocalVariable(value, args)), |
| 905 | aliases: ['getchatvar'], | ||
| 903 | returns: 'the variable value', | 906 | returns: 'the variable value', |
| 904 | namedArgumentList: [ | 907 | namedArgumentList: [ |
| 905 | SlashCommandNamedArgument.fromProps({ | 908 | SlashCommandNamedArgument.fromProps({ |
| @@ -943,6 +946,7 @@ export function registerVariableCommands() { | |||
| 943 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 946 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 944 | name: 'addvar', | 947 | name: 'addvar', |
| 945 | callback: (args, value) => String(addLocalVariable(args.key || args.name, value)), | 948 | callback: (args, value) => String(addLocalVariable(args.key || args.name, value)), |
| 949 | aliases: ['addchatvar'], | ||
| 946 | returns: 'the new variable value', | 950 | returns: 'the new variable value', |
| 947 | namedArgumentList: [ | 951 | namedArgumentList: [ |
| 948 | SlashCommandNamedArgument.fromProps({ | 952 | SlashCommandNamedArgument.fromProps({ |
| @@ -1087,6 +1091,7 @@ export function registerVariableCommands() { | |||
| 1087 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 1091 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 1088 | name: 'incvar', | 1092 | name: 'incvar', |
| 1089 | callback: (_, value) => String(incrementLocalVariable(value)), | 1093 | callback: (_, value) => String(incrementLocalVariable(value)), |
| 1094 | aliases: ['incchatvar'], | ||
| 1090 | returns: 'the new variable value', | 1095 | returns: 'the new variable value', |
| 1091 | unnamedArgumentList: [ | 1096 | unnamedArgumentList: [ |
| 1092 | SlashCommandNamedArgument.fromProps({ | 1097 | SlashCommandNamedArgument.fromProps({ |
| @@ -1115,6 +1120,7 @@ export function registerVariableCommands() { | |||
| 1115 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 1120 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 1116 | name: 'decvar', | 1121 | name: 'decvar', |
| 1117 | callback: (_, value) => String(decrementLocalVariable(value)), | 1122 | callback: (_, value) => String(decrementLocalVariable(value)), |
| 1123 | aliases: ['decchatvar'], | ||
| 1118 | returns: 'the new variable value', | 1124 | returns: 'the new variable value', |
| 1119 | unnamedArgumentList: [ | 1125 | unnamedArgumentList: [ |
| 1120 | SlashCommandNamedArgument.fromProps({ | 1126 | SlashCommandNamedArgument.fromProps({ |
| @@ -1401,6 +1407,7 @@ export function registerVariableCommands() { | |||
| 1401 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 1407 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 1402 | name: 'flushvar', | 1408 | name: 'flushvar', |
| 1403 | callback: async (_, value) => deleteLocalVariable(value instanceof SlashCommandClosure ? (await value.execute())?.pipe : String(value)), | 1409 | callback: async (_, value) => deleteLocalVariable(value instanceof SlashCommandClosure ? (await value.execute())?.pipe : String(value)), |
| 1410 | aliases: ['flushchatvar'], | ||
| 1404 | unnamedArgumentList: [ | 1411 | unnamedArgumentList: [ |
| 1405 | SlashCommandNamedArgument.fromProps({ | 1412 | SlashCommandNamedArgument.fromProps({ |
| 1406 | name: 'key', | 1413 | name: 'key', |
| @@ -1870,6 +1877,7 @@ export function registerVariableCommands() { | |||
| 1870 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | 1877 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 1871 | name: 'len', | 1878 | name: 'len', |
| 1872 | callback: (_, value) => String(lenValuesCallback(value)), | 1879 | callback: (_, value) => String(lenValuesCallback(value)), |
| 1880 | aliases: ['length'], | ||
| 1873 | returns: 'length of the provided value', | 1881 | returns: 'length of the provided value', |
| 1874 | unnamedArgumentList: [ | 1882 | unnamedArgumentList: [ |
| 1875 | SlashCommandArgument.fromProps({ | 1883 | SlashCommandArgument.fromProps({ |