Remove long deprecated STscript commands and parameters (#5312) * Remove deprecated 'format' argument from /listinjects and /listvars commands * Remove deprecated /lock command and add as alias to /persona-lock * Add 'bind' as an alias for /persona-lock command (#5321) * Initial plan * Add 'bind' as an alias for /persona-lock command Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
Signed| @@ -1897,6 +1897,7 @@ function syncCallback() { | ||
| 1897 | 1897 | function registerPersonaSlashCommands() { |
| 1898 | 1898 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 1899 | 1899 | name: 'persona-lock', |
| 1900 | + aliases: ['lock', 'bind'], | |
| 1900 | 1901 | callback: lockPersonaCallback, |
| 1901 | 1902 | returns: 'The current lock state for the given type', |
| 1902 | 1903 | helpString: 'Locks/unlocks a persona (name and avatar) to the current chat. Gets the current lock state for the given type if no state is provided.', |
| @@ -1921,43 +1922,6 @@ function registerPersonaSlashCommands() { | ||
| 1921 | 1922 | }), |
| 1922 | 1923 | ], |
| 1923 | 1924 | })); |
| 1924 | - // TODO: Legacy command. Might be removed in the future and replaced by /persona-lock with aliases. | |
| 1925 | - SlashCommandParser.addCommandObject(SlashCommand.fromProps({ | |
| 1926 | - name: 'lock', | |
| 1927 | - /** @type {(args: { type: string }, value: string) => Promise<string>} */ | |
| 1928 | - callback: (args, value) => { | |
| 1929 | - if (!value) { | |
| 1930 | - value = 'toggle'; | |
| 1931 | - toastr.warning(t`Using /lock without a provided state to toggle the persona is deprecated. Please use /persona-lock instead. | |
| 1932 | - In the future this command with no state provided will return the current state, instead of toggling it.`, t`Deprecation Warning`); | |
| 1933 | - } | |
| 1934 | - return lockPersonaCallback(args, value); | |
| 1935 | - }, | |
| 1936 | - returns: 'The current lock state for the given type', | |
| 1937 | - aliases: ['bind'], | |
| 1938 | - helpString: 'Locks/unlocks a persona (name and avatar) to the current chat. Gets the current lock state for the given type if no state is provided.', | |
| 1939 | - namedArgumentList: [ | |
| 1940 | - SlashCommandNamedArgument.fromProps({ | |
| 1941 | - name: 'type', | |
| 1942 | - description: 'The type of the lock, where it should apply to', | |
| 1943 | - typeList: [ARGUMENT_TYPE.STRING], | |
| 1944 | - defaultValue: 'chat', | |
| 1945 | - enumList: [ | |
| 1946 | - new SlashCommandEnumValue('chat', 'Lock the persona to the current chat.'), | |
| 1947 | - new SlashCommandEnumValue('character', 'Lock this persona to the currently selected character. If the setting is enabled, multiple personas can be locked to the same character.'), | |
| 1948 | - new SlashCommandEnumValue('default', 'Lock this persona as the default persona for all new chats.'), | |
| 1949 | - ], | |
| 1950 | - }), | |
| 1951 | - ], | |
| 1952 | - unnamedArgumentList: [ | |
| 1953 | - SlashCommandArgument.fromProps({ | |
| 1954 | - description: 'state', | |
| 1955 | - typeList: [ARGUMENT_TYPE.STRING], | |
| 1956 | - defaultValue: 'toggle', | |
| 1957 | - enumProvider: commonEnumProviders.boolean('onOffToggle'), | |
| 1958 | - }), | |
| 1959 | - ], | |
| 1960 | - })); | |
| 1961 | 1925 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 1962 | 1926 | name: 'persona-set', |
| 1963 | 1927 | callback: setNameCallback, |
| @@ -2939,19 +2939,6 @@ export function initDefaultSlashCommands() { | ||
| 2939 | 2939 | enumList: slashCommandReturnHelper.enumList({ allowPipe: false, allowObject: true, allowChat: true, allowPopup: true, allowTextVersion: false }), |
| 2940 | 2940 | forceEnum: true, |
| 2941 | 2941 | }), |
| 2942 | - // TODO remove some day | |
| 2943 | - SlashCommandNamedArgument.fromProps({ | |
| 2944 | - name: 'format', | |
| 2945 | - description: t`!!! DEPRECATED - use "return" instead !!! output format`, | |
| 2946 | - typeList: [ARGUMENT_TYPE.STRING], | |
| 2947 | - isRequired: true, | |
| 2948 | - forceEnum: true, | |
| 2949 | - enumList: [ | |
| 2950 | - new SlashCommandEnumValue('popup', t`Show injects in a popup.`, enumTypes.enum, enumIcons.default), | |
| 2951 | - new SlashCommandEnumValue('chat', t`Post a system message to the chat.`, enumTypes.enum, enumIcons.default), | |
| 2952 | - new SlashCommandEnumValue('none', t`Just return the injects as a JSON object.`, enumTypes.enum, enumIcons.default), | |
| 2953 | - ], | |
| 2954 | - }), | |
| 2955 | 2942 | ], |
| 2956 | 2943 | })); |
| 2957 | 2944 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| @@ -3810,27 +3797,6 @@ async function listInjectsCallback(args) { | ||
| 3810 | 3797 | /** @type {import('./slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */ |
| 3811 | 3798 | let returnType = args.return; |
| 3812 | 3799 | |
| 3813 | - // Old legacy return type handling | |
| 3814 | - if (args.format) { | |
| 3815 | - toastr.warning(t`Legacy argument 'format' with value '${args.format}' is deprecated. Please use 'return' instead. Routing to the correct return type...`, t`Deprecation warning`); | |
| 3816 | - const type = String(args?.format).toLowerCase().trim(); | |
| 3817 | - if (!chat_metadata.script_injects || !Object.keys(chat_metadata.script_injects).length) { | |
| 3818 | - type !== 'none' && toastr.info(t`No script injections for the current chat`); | |
| 3819 | - } | |
| 3820 | - switch (type) { | |
| 3821 | - case 'none': | |
| 3822 | - returnType = 'none'; | |
| 3823 | - break; | |
| 3824 | - case 'chat': | |
| 3825 | - returnType = 'chat-html'; | |
| 3826 | - break; | |
| 3827 | - case 'popup': | |
| 3828 | - default: | |
| 3829 | - returnType = 'popup-html'; | |
| 3830 | - break; | |
| 3831 | - } | |
| 3832 | - } | |
| 3833 | - | |
| 3834 | 3800 | // Now the actual new return type handling |
| 3835 | 3801 | const buildTextValue = (injects) => { |
| 3836 | 3802 | const injectsStr = Object.entries(injects) |
| @@ -264,24 +264,6 @@ async function listVariablesCallback(args) { | ||
| 264 | 264 | /** @type {import('./slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */ |
| 265 | 265 | let returnType = args.return; |
| 266 | 266 | |
| 267 | - // Old legacy return type handling | |
| 268 | - if (args.format) { | |
| 269 | - toastr.warning(`Legacy argument 'format' with value '${args.format}' is deprecated. Please use 'return' instead. Routing to the correct return type...`, 'Deprecation warning'); | |
| 270 | - const type = String(args?.format).toLowerCase().trim(); | |
| 271 | - switch (type) { | |
| 272 | - case 'none': | |
| 273 | - returnType = 'none'; | |
| 274 | - break; | |
| 275 | - case 'chat': | |
| 276 | - returnType = 'chat-html'; | |
| 277 | - break; | |
| 278 | - case 'popup': | |
| 279 | - default: | |
| 280 | - returnType = 'popup-html'; | |
| 281 | - break; | |
| 282 | - } | |
| 283 | - } | |
| 284 | - | |
| 285 | 267 | // Now the actual new return type handling |
| 286 | 268 | const scope = String(args?.scope || '').toLowerCase().trim() || 'all'; |
| 287 | 269 | if (!chat_metadata.variables) { |
| @@ -946,19 +928,6 @@ export function registerVariableCommands() { | ||
| 946 | 928 | enumList: slashCommandReturnHelper.enumList({ allowPipe: false, allowObject: true, allowChat: true, allowPopup: true, allowTextVersion: false }), |
| 947 | 929 | forceEnum: true, |
| 948 | 930 | }), |
| 949 | - // TODO remove some day | |
| 950 | - SlashCommandNamedArgument.fromProps({ | |
| 951 | - name: 'format', | |
| 952 | - description: '!!! DEPRECATED - use "return" instead !!! output format', | |
| 953 | - typeList: [ARGUMENT_TYPE.STRING], | |
| 954 | - isRequired: true, | |
| 955 | - forceEnum: true, | |
| 956 | - enumList: [ | |
| 957 | - new SlashCommandEnumValue('popup', 'Show variables in a popup.', enumTypes.enum, enumIcons.default), | |
| 958 | - new SlashCommandEnumValue('chat', 'Post a system message to the chat.', enumTypes.enum, enumIcons.message), | |
| 959 | - new SlashCommandEnumValue('none', 'Just return the variables as a JSON list.', enumTypes.enum, enumIcons.array), | |
| 960 | - ], | |
| 961 | - }), | |
| 962 | 931 | ], |
| 963 | 932 | })); |
| 964 | 933 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |