Skip to main content
Version: Next

StringSelectMenuKit

StringSelectMenuKit

A builder for creating string select menus with additional features like interaction collectors and event handling. This class extends the StringSelectMenuBuilder from discord.js and adds methods for handling interactions. It allows you to set a handler for when the string select menu is submitted, filter interactions, and handle the end of the interaction collector.

Signature
class StringSelectMenuKit extends StringSelectMenuBuilder {
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<
StringSelectMenuInteraction,
StringSelectMenuKit
>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData) => this;
onEnd(handler: CommandKitSelectMenuBuilderOnEnd) => this;
onError(handler: EventInterceptorErrorHandler) => this;
filter(predicate: SelectMenuKitPredicate<StringSelectMenuInteraction>) => this;
dispose() => ;
}
  • Extends: StringSelectMenuBuilder

onSelect

Sets the handler to run when the modal is submitted.

Example

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);

onEnd

method

Sets the handler to run when the interaction collector ends.

onError

method
(handler: EventInterceptorErrorHandler) => this

Sets the handler to run when the interaction collector ends.

filter

method
(predicate: SelectMenuKitPredicate<StringSelectMenuInteraction>) => this

Sets a filter for the interaction collector.

dispose

method
() =>

Disposes of the interaction collector and cleans up resources.