Skip to main content
Version: Next

StringSelectMenuKit

StringSelectMenuKit extends StringSelectMenuBuilder

new StringSelectMenuKit(data)
ParameterTypeOptional
dataPartial<APIStringSelectComponent | StringSelectMenuComponentData>

Properties

public data: any

The API data associated with this component.

public options: any

The options within this select menu.

Methods

public addOptions(options): this

Adds options to this select menu.

ParameterTypeOptionalDescription
optionsRestOrArray<StringSelectMenuOptionBuilderSelectMenuComponentOptionDataAPISelectMenuOption>

public clearId(): this

Clears the id of this component, defaulting to a default incremented id.

public dispose(): StringSelectMenuKit

public filter(predicate): this

Sets a filter for the interaction collector.

ParameterTypeOptionalDescription
predicateSelectMenuKitPredicate<StringSelectMenuInteraction>The filter to use for the interaction collector.

public onEnd(handler): this

Sets the handler to run when the interaction collector ends.

ParameterTypeOptionalDescription
handlerCommandKitSelectMenuBuilderOnEndThe handler to run when the interaction collector ends.

public onError(handler): this

Sets the handler to run when the interaction collector ends.

ParameterTypeOptionalDescription
handlerEventInterceptorErrorHandlerThe handler to run when the interaction collector ends.

public onSelect(handler, data?): this

Sets the handler to run when the modal is submitted.

const modal = new StringSelectMenuKit()
.setTitle('My Modal')
.setCustomId('my-modal')
.filter((interaction) => interaction.user.id === '1234567890')
.onSelect(async (interaction) => {
await interaction.reply('You submitted the modal!');
})
.addComponents(actionRow1, actionRow2);
ParameterTypeOptionalDescription
handlerCommandKitSelectMenuBuilderInteractionCollectorDispatch<StringSelectMenuInteractionStringSelectMenuKit>
dataCommandKitSelectMenuBuilderInteractionCollectorDispatchContextDataThe context data for the interaction collector.

public setCustomId(customId): this

Sets the custom id for this select menu.

ParameterTypeOptionalDescription
customIdstringThe custom id to use

public setDisabled(disabled?): this

Sets whether this select menu is disabled.

ParameterTypeOptionalDescription
disabledbooleanWhether this select menu is disabled

public setId(id): this

Sets the id (not the custom id) for this component.

ParameterTypeOptionalDescription
idnumberThe id for this component

public setMaxValues(maxValues): this

Sets the maximum values that must be selected in the select menu.

ParameterTypeOptionalDescription
maxValuesnumberThe maximum values that must be selected

public setMinValues(minValues): this

Sets the minimum values that must be selected in the select menu.

ParameterTypeOptionalDescription
minValuesnumberThe minimum values that must be selected

public setOptions(options): this

Sets the options for this select menu.

ParameterTypeOptionalDescription
optionsRestOrArray<StringSelectMenuOptionBuilderSelectMenuComponentOptionDataAPISelectMenuOption>

public setPlaceholder(placeholder): this

Sets the placeholder for this select menu.

ParameterTypeOptionalDescription
placeholderstringThe placeholder to use

public spliceOptions(index, deleteCount, options): this

Removes, replaces, or inserts options for this select menu.

Remove the first option:

selectMenu.spliceOptions(0, 1);

Remove the first n option:

const n = 4;
selectMenu.spliceOptions(0, n);

Remove the last option:

selectMenu.spliceOptions(-1, 1);
ParameterTypeOptionalDescription
indexnumberThe index to start at
deleteCountnumberThe number of options to remove
optionsRestOrArray<StringSelectMenuOptionBuilderAPISelectMenuOption>

public toJSON(): APIStringSelectComponent

BaseSelectMenuBuilder.toJSON

public static from(other): StringSelectMenuBuilder

ParameterTypeOptional
otherAPIStringSelectComponentJSONEncodable<APIStringSelectComponent>