UserSelectMenuKit
UserSelectMenuKit extends UserSelectMenuBuilder
new UserSelectMenuKit(data)
Parameter | Type | Optional |
---|---|---|
data | Partial<APIUserSelectComponent | UserSelectMenuComponentData> | ✅ |
Properties
public data: any
The API data associated with this component.
Methods
public addDefaultUsers(users): this
Adds default users to this auto populated select menu.
Parameter | Type | Optional | Description |
---|---|---|---|
users | RestOrArray<string> | ❌ | The users to add |
public clearId(): this
Clears the id of this component, defaulting to a default incremented id.
public dispose(): UserSelectMenuKit
public filter(predicate): this
Sets a filter for the interaction collector.
Parameter | Type | Optional | Description |
---|---|---|---|
predicate | SelectMenuKitPredicate<UserSelectMenuInteraction> | ❌ | The filter to use for the interaction collector. |
public onEnd(handler): this
Sets the handler to run when the interaction collector ends.
Parameter | Type | Optional | Description |
---|---|---|---|
handler | CommandKitSelectMenuBuilderOnEnd | ❌ | The handler to run when the interaction collector ends. |
public onError(handler): this
Sets the handler to run when the interaction collector ends.
Parameter | Type | Optional | Description |
---|---|---|---|
handler | EventInterceptorErrorHandler | ❌ | The 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 UserSelectMenuKit()
.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);
Parameter | Type | Optional | Description |
---|---|---|---|
handler | CommandKitSelectMenuBuilderInteractionCollectorDispatch<UserSelectMenuInteraction | UserSelectMenuKit> | ❌ |
data | CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData | ✅ | The context data for the interaction collector. |
public setCustomId(customId): this
Sets the custom id for this select menu.
Parameter | Type | Optional | Description |
---|---|---|---|
customId | string | ❌ | The custom id to use |
public setDefaultUsers(users): this
Sets default users for this auto populated select menu.
Parameter | Type | Optional | Description |
---|---|---|---|
users | RestOrArray<string> | ❌ | The users to set |
public setDisabled(disabled?): this
Sets whether this select menu is disabled.
Parameter | Type | Optional | Description |
---|---|---|---|
disabled | boolean | ✅ | Whether this select menu is disabled |
public setId(id): this
Sets the id (not the custom id) for this component.
Parameter | Type | Optional | Description |
---|---|---|---|
id | number | ❌ | The id for this component |
public setMaxValues(maxValues): this
Sets the maximum values that must be selected in the select menu.
Parameter | Type | Optional | Description |
---|---|---|---|
maxValues | number | ❌ | The maximum values that must be selected |
public setMinValues(minValues): this
Sets the minimum values that must be selected in the select menu.
Parameter | Type | Optional | Description |
---|---|---|---|
minValues | number | ❌ | The minimum values that must be selected |
public setPlaceholder(placeholder): this
Sets the placeholder for this select menu.
Parameter | Type | Optional | Description |
---|---|---|---|
placeholder | string | ❌ | The placeholder to use |
public toJSON(): APIUserSelectComponent
ComponentBuilder.toJSON
public static from(other): UserSelectMenuBuilder
Parameter | Type | Optional |
---|---|---|
other | APIUserSelectComponent | JSONEncodable<APIUserSelectComponent> |