SelectMenuInteraction
classe · Source
Represents a select menu interaction.
Extends: MessageComponentInteraction
Properties
values
The values selected, if the component which was interacted with was a select menu Source
channelId
The id of the channel this interaction was sent in Source
message
The message to which the component was attached Source
customId
The custom id of the component which was interacted with Source
componentType
The type of component which was interacted with Source
deferred
Whether the reply to this interaction has been deferred Source
ephemeral
nullable
Whether the reply to this interaction is ephemeral Source
replied
Whether this interaction has already been replied to Source
webhook
An associated interaction webhook, can be used to further interact with this interaction Source
component
readonly
The component which was interacted with Source
type
The interaction's type Source
id
The interaction's id Source
token
readonly
The interaction's token Source
applicationId
The application's id Source
guildId
nullable
The id of the guild this interaction was sent in Source
user
The user which sent this interaction Source
member
nullable
If this interaction was sent in a guild, the member which sent it Source
version
The version Source
appPermissions
nullable
Set of permissions the application or bot has within the channel the interaction was sent from Source
memberPermissions
nullable
The permissions of the member, if one exists, in the channel this interaction was executed in Source
locale
The locale of the user who invoked this interaction Source
guildLocale
nullable
The preferred locale from the guild this interaction was sent in Source
authorizingIntegrationOwners
Owners for each installation context that authorized this interaction. Source
createdTimestamp
readonly
The timestamp the interaction was created at Source
createdAt
readonly
The time the interaction was created at Source
channel
readonly · nullable
The channel this interaction was sent in Source
guild
readonly · nullable
The guild this interaction was sent in Source
client
readonly
The client that instantiated this Source
Methods
deferReply
async
Defers the reply to this interaction. Parameters
| Name | Type | Description |
|---|---|---|
options? | InteractionDeferReplyOptions | Options for deferring the reply to this interaction |
Returns: Promise<(Message\|APIMessage\|void)>
// Defer the reply to this interaction
interaction.deferReply()
.then(console.log)
.catch(console.error)2
3
4
// Defer to send an ephemeral reply later
interaction.deferReply({ ephemeral: true })
.then(console.log)
.catch(console.error);2
3
4
reply
async
Creates a reply to this interaction. Use the fetchReply option to get the bot's reply message. Parameters
| Name | Type | Description |
|---|---|---|
options | string | MessagePayload | InteractionReplyOptions | The options for the reply |
Returns: Promise<(Message\|APIMessage\|void)>
// Reply to the interaction and fetch the response
interaction.reply({ content: 'Pong!', fetchReply: true })
.then((message) => console.log(`Reply sent with content ${message.content}`))
.catch(console.error);2
3
4
// Create an ephemeral reply with an embed
const embed = new MessageEmbed().setDescription('Pong!');
interaction.reply({ embeds: [embed], ephemeral: true })
.then(() => console.log('Reply sent.'))
.catch(console.error);2
3
4
5
6
fetchReply
Fetches a reply to this interaction. Parameters
| Name | Type | Description |
|---|---|---|
message? | MessageResolvable | '@original' | The response to fetch Default: '@original'. |
Returns: Promise<(Message\|APIMessage)>
// Fetch the initial reply to this interaction
interaction.fetchReply()
.then(reply => console.log(`Replied with ${reply.content}`))
.catch(console.error);2
3
4
editReply
async
Edits a reply to this interaction. Parameters
| Name | Type | Description |
|---|---|---|
options | string | MessagePayload | InteractionEditReplyOptions | The new options for the message |
Returns: Promise<(Message\|APIMessage)>
// Edit the initial reply to this interaction
interaction.editReply('New content')
.then(console.log)
.catch(console.error);2
3
4
deleteReply
async
Deletes a reply to this interaction. Parameters
| Name | Type | Description |
|---|---|---|
message? | MessageResolvable | '@original' | The response to delete Default: '@original'. |
Returns: Promise<void>
// Delete the initial reply to this interaction
interaction.deleteReply()
.then(console.log)
.catch(console.error);2
3
4
followUp
async
Send a follow-up message to this interaction. Parameters
| Name | Type | Description |
|---|---|---|
options | string | MessagePayload | InteractionReplyOptions | The options for the reply |
Returns: Promise<(Message\|APIMessage)>Source
deferUpdate
async
Defers an update to the message to which the component was attached. Parameters
| Name | Type | Description |
|---|---|---|
options? | InteractionDeferUpdateOptions | Options for deferring the update to this interaction |
Returns: Promise<(Message\|APIMessage\|void)>
// Defer updating and reset the component's loading state
interaction.deferUpdate()
.then(console.log)
.catch(console.error);2
3
4
update
async
Updates the original message of the component on which the interaction was received on. Parameters
| Name | Type | Description |
|---|---|---|
options? | string | MessagePayload | InteractionUpdateOptions | The options for the updated message |
Returns: Promise<(Message\|APIMessage\|void)>
// Remove the components from the message
interaction.update({
content: "A component interaction was received",
components: []
})
.then(console.log)
.catch(console.error);2
3
4
5
6
7
showModal
async
Shows a modal component Parameters
| Name | Type | Description |
|---|---|---|
modal | Modal | ModalOptions | The modal to show |
Returns: Promise<void>Source
awaitModalSubmit
Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires. Parameters
| Name | Type | Description |
|---|---|---|
options | AwaitModalSubmitOptions | Options to pass to the internal collector |
Returns: Promise<ModalSubmitInteraction>
// Collect a modal submit interaction
const filter = (interaction) => interaction.customId === 'modal';
interaction.awaitModalSubmit({ filter, time: 15_000 })
.then(interaction => console.log(`${interaction.customId} was submitted!`))
.catch(console.error);2
3
4
5
inGuild
Indicates whether this interaction is received from a guild. Returns: booleanSource
inCachedGuild
Indicates whether or not this interaction is both cached and received from a guild. Returns: booleanSource
inRawGuild
Indicates whether or not this interaction is received from an uncached guild. Returns: booleanSource
isApplicationCommand
Indicates whether this interaction is a BaseCommandInteraction. Returns: booleanSource
isCommand
Indicates whether this interaction is a CommandInteraction. Returns: booleanSource
isContextMenu
Indicates whether this interaction is a ContextMenuInteractionReturns: booleanSource
isModalSubmit
Indicates whether this interaction is a ModalSubmitInteractionReturns: booleanSource
isUserContextMenu
Indicates whether this interaction is a UserContextMenuInteractionReturns: booleanSource
isMessageContextMenu
Indicates whether this interaction is a MessageContextMenuInteractionReturns: booleanSource
isAutocomplete
Indicates whether this interaction is an AutocompleteInteractionReturns: booleanSource
isMessageComponent
Indicates whether this interaction is a MessageComponentInteraction. Returns: booleanSource
isButton
Indicates whether this interaction is a ButtonInteraction. Returns: booleanSource
isSelectMenu
Indicates whether this interaction is a SelectMenuInteraction. Returns: booleanSource
isRepliable
Indicates whether this interaction can be replied to. Returns: booleanSource