Update /mul, /max and /min definition

- Update command definition for /mul, /max and /min to fit the actual code behind, split them too
- Add numbersAndVariables enum provider, to centralize
This commit is contained in:
Wolfsblvt
2024-09-30 20:45:39 +02:00
parent 0d38e63471
commit 4855f25419
2 changed files with 36 additions and 25 deletions

View File

@ -152,6 +152,35 @@ export const commonEnumProviders = {
].filter((item, idx, list)=>idx == list.findIndex(it=>it.value == item.value));
},
/**
* Enum values for numbers and variable names
*
* Includes all variable names and the ability to specify any number
*
* @param {SlashCommandExecutor} executor - The executor of the slash command
* @param {SlashCommandScope} scope - The scope of the slash command
* @returns {SlashCommandEnumValue[]} The enum values
*/
numbersAndVariables: (executor, scope) => [
...commonEnumProviders.variables('all')(executor, scope),
new SlashCommandEnumValue(
'any variable name',
null,
enumTypes.variable,
enumIcons.variable,
(input) => /^\w*$/.test(input),
(input) => input,
),
new SlashCommandEnumValue(
'any number',
null,
enumTypes.number,
enumIcons.number,
(input) => input == '' || !Number.isNaN(Number(input)),
(input) => input,
),
],
/**
* All possible char entities, like characters and groups. Can be filtered down to just one type.
*