| 2069 | 2069 | helpString: 'Runs a Regex extension script by name on the provided string. The script must be enabled.', |
| 2070 | 2070 | })); |
| 2071 | 2071 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 2072 | + name: 'regex-state', |
| 2073 | + /** @param {object} _ @param {string} name */ |
| 2074 | + callback: (_, name) => { |
| 2075 | + if (!name) { |
| 2076 | + toastr.warning('No regex script name provided.'); |
| 2077 | + return ''; |
| 2078 | + } |
| 2079 | + |
| 2080 | + const scripts = getRegexScripts(); |
| 2081 | + const script = scripts.find(s => equalsIgnoreCaseAndAccents(s.scriptName, name)); |
| 2082 | + |
| 2083 | + if (!script) { |
| 2084 | + toastr.warning(`Regex script "${name}" not found.`); |
| 2085 | + return ''; |
| 2086 | + } |
| 2087 | + |
| 2088 | + return script.disabled ? 'false' : 'true'; |
| 2089 | + }, |
| 2090 | + returns: 'true (for enabled) or false (for disabled)', |
| 2091 | + unnamedArgumentList: [ |
| 2092 | + SlashCommandArgument.fromProps({ |
| 2093 | + description: 'script name', |
| 2094 | + typeList: [ARGUMENT_TYPE.STRING], |
| 2095 | + isRequired: true, |
| 2096 | + enumProvider: localEnumProviders.regexScripts, |
| 2097 | + }), |
| 2098 | + ], |
| 2099 | + helpString: 'Returns the current state of a regex script.', |
| 2100 | + })); |
| 2101 | + |
| 2102 | + SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 2072 | 2103 | name: 'regex-toggle', |
| 2073 | 2104 | callback: toggleRegexCallback, |
| 2074 | 2105 | returns: 'The name of the script that was toggled', |