RoleSelectMenuKit
RoleSelectMenuKit
A builder for creating role select menus with additional features like interaction collectors and event handling. This class extends the RoleSelectMenuBuilder from discord.js and adds methods for handling interactions. It allows you to set a handler for when the role select menu is submitted, filter interactions, and handle the end of the interaction collector.
class RoleSelectMenuKit extends RoleSelectMenuBuilder {
onSelect(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch<
RoleSelectMenuInteraction,
RoleSelectMenuKit
>, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData) => this;
onEnd(handler: CommandKitSelectMenuBuilderOnEnd) => this;
onError(handler: EventInterceptorErrorHandler) => this;
filter(predicate: SelectMenuKitPredicate<RoleSelectMenuInteraction>) => this;
dispose() => ;
}
- Extends:
RoleSelectMenuBuilder
onSelect
(handler: CommandKitSelectMenuBuilderInteractionCollectorDispatch< RoleSelectMenuInteraction, RoleSelectMenuKit >, data?: CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData) => thisSets the handler to run when the modal is submitted.
Example
const modal = new RoleSelectMenuKit()
.setTitle('My Modal')
.setCustomId('my-modal')
.filter((interaction) => interaction.Role.id === '1234567890')
.onSelect(async (interaction) => {
await interaction.reply('You submitted the modal!');
})
.addComponents(actionRow1, actionRow2);
onEnd
(handler: CommandKitSelectMenuBuilderOnEnd) => thisSets the handler to run when the interaction collector ends.
onError
(handler: EventInterceptorErrorHandler) => thisSets the handler to run when the interaction collector ends.
filter
(predicate: SelectMenuKitPredicate<RoleSelectMenuInteraction>) => thisSets a filter for the interaction collector.
dispose
() => Disposes of the role select menu kit, cleaning up any resources and event listeners.