| 4072 | 4072 | ], |
| 4073 | 4073 | helpString: 'activates a movingUI preset by name', |
| 4074 | 4074 | })); |
| 4075 | + SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 4076 | + name: 'stop-strings', |
| 4077 | + aliases: ['stopping-strings'], |
| 4078 | + helpString: 'Sets a list of custom stopping strings. Gets the list if no value is provided.', |
| 4079 | + returns: ARGUMENT_TYPE.LIST, |
| 4080 | + unnamedArgumentList: [ |
| 4081 | + SlashCommandArgument.fromProps({ |
| 4082 | + description: 'list of strings', |
| 4083 | + typeList: [ARGUMENT_TYPE.LIST], |
| 4084 | + acceptsMultiple: false, |
| 4085 | + isRequired: false, |
| 4086 | + }), |
| 4087 | + ], |
| 4088 | + callback: (_, value) => { |
| 4089 | + if (String(value ?? '').trim()) { |
| 4090 | + const parsedValue = ((x) => { try { return JSON.parse(x.toString()); } catch { return null; } })(value); |
| 4091 | + if (!parsedValue || !Array.isArray(parsedValue)) { |
| 4092 | + throw new Error('Invalid list format. The value must be a JSON-serialized array of strings.'); |
| 4093 | + } |
| 4094 | + parsedValue.forEach((item, index) => { |
| 4095 | + parsedValue[index] = String(item); |
| 4096 | + }); |
| 4097 | + power_user.custom_stopping_strings = JSON.stringify(parsedValue); |
| 4098 | + $('#custom_stopping_strings').val(power_user.custom_stopping_strings); |
| 4099 | + saveSettingsDebounced(); |
| 4100 | + } |
| 4101 | + |
| 4102 | + return power_user.custom_stopping_strings; |
| 4103 | + }, |
| 4104 | + })); |
| 4075 | 4105 | }); |