mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-03 03:17:54 +01:00
Fix oversight in forceEnum slash commands
This commit is contained in:
parent
cba2b54531
commit
75099d3a22
@ -59,7 +59,7 @@ export class SlashCommandArgument {
|
|||||||
* @param {string|SlashCommandEnumValue|(string|SlashCommandEnumValue)[]} enums
|
* @param {string|SlashCommandEnumValue|(string|SlashCommandEnumValue)[]} enums
|
||||||
* @param {(executor:SlashCommandExecutor)=>SlashCommandEnumValue[]} enumProvider function that returns auto complete options
|
* @param {(executor:SlashCommandExecutor)=>SlashCommandEnumValue[]} enumProvider function that returns auto complete options
|
||||||
*/
|
*/
|
||||||
constructor(description, types, isRequired = false, acceptsMultiple = false, defaultValue = null, enums = [], enumProvider = null, forceEnum = true) {
|
constructor(description, types, isRequired = false, acceptsMultiple = false, defaultValue = null, enums = [], enumProvider = null, forceEnum = false) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.typeList = types ? Array.isArray(types) ? types : [types] : [];
|
this.typeList = types ? Array.isArray(types) ? types : [types] : [];
|
||||||
this.isRequired = isRequired ?? false;
|
this.isRequired = isRequired ?? false;
|
||||||
@ -90,7 +90,7 @@ export class SlashCommandNamedArgument extends SlashCommandArgument {
|
|||||||
* @param {string|SlashCommandClosure} [props.defaultValue=null] default value if no value is provided
|
* @param {string|SlashCommandClosure} [props.defaultValue=null] default value if no value is provided
|
||||||
* @param {string|SlashCommandEnumValue|(string|SlashCommandEnumValue)[]} [props.enumList=[]] list of accepted values
|
* @param {string|SlashCommandEnumValue|(string|SlashCommandEnumValue)[]} [props.enumList=[]] list of accepted values
|
||||||
* @param {(executor:SlashCommandExecutor)=>SlashCommandEnumValue[]} [props.enumProvider=null] function that returns auto complete options
|
* @param {(executor:SlashCommandExecutor)=>SlashCommandEnumValue[]} [props.enumProvider=null] function that returns auto complete options
|
||||||
* @param {boolean} [props.forceEnum=true] default: true - whether the input must match one of the enum values
|
* @param {boolean} [props.forceEnum=false] default: false - whether the input must match one of the enum values
|
||||||
*/
|
*/
|
||||||
static fromProps(props) {
|
static fromProps(props) {
|
||||||
return new SlashCommandNamedArgument(
|
return new SlashCommandNamedArgument(
|
||||||
@ -103,7 +103,7 @@ export class SlashCommandNamedArgument extends SlashCommandArgument {
|
|||||||
props.enumList ?? [],
|
props.enumList ?? [],
|
||||||
props.aliasList ?? [],
|
props.aliasList ?? [],
|
||||||
props.enumProvider ?? null,
|
props.enumProvider ?? null,
|
||||||
props.forceEnum ?? true,
|
props.forceEnum ?? false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +120,9 @@ export class SlashCommandNamedArgument extends SlashCommandArgument {
|
|||||||
* @param {string|SlashCommandEnumValue|(string|SlashCommandEnumValue)[]} [enums=[]]
|
* @param {string|SlashCommandEnumValue|(string|SlashCommandEnumValue)[]} [enums=[]]
|
||||||
* @param {string[]} [aliases=[]]
|
* @param {string[]} [aliases=[]]
|
||||||
* @param {(executor:SlashCommandExecutor)=>SlashCommandEnumValue[]} [enumProvider=null] function that returns auto complete options
|
* @param {(executor:SlashCommandExecutor)=>SlashCommandEnumValue[]} [enumProvider=null] function that returns auto complete options
|
||||||
* @param {boolean} [forceEnum=true]
|
* @param {boolean} [forceEnum=false]
|
||||||
*/
|
*/
|
||||||
constructor(name, description, types, isRequired = false, acceptsMultiple = false, defaultValue = null, enums = [], aliases = [], enumProvider = null, forceEnum = true) {
|
constructor(name, description, types, isRequired = false, acceptsMultiple = false, defaultValue = null, enums = [], aliases = [], enumProvider = null, forceEnum = false) {
|
||||||
super(description, types, isRequired, acceptsMultiple, defaultValue, enums, enumProvider, forceEnum);
|
super(description, types, isRequired, acceptsMultiple, defaultValue, enums, enumProvider, forceEnum);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.aliasList = aliases ? Array.isArray(aliases) ? aliases : [aliases] : [];
|
this.aliasList = aliases ? Array.isArray(aliases) ? aliases : [aliases] : [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user