ComponentInteraction

ComponentInteraction

Represents a message component interaction. See Interaction for more properties

Constructor

new ComponentInteraction()

Properties:
Properties
Name Type Attributes Description
appPermissions Permission <nullable>

The permissions the app or bot has within the channel the interaction was sent from

channel DMChannel | TextChannel | NewsChannel

The channel the interaction was created in. Can be partial with only the id if the channel is not cached

data Object

The data attached to the interaction

Properties
Name Type Attributes Description
component_type Number

The type of Message Component

custom_id String

The ID of the Message Component

resolved Object <nullable>

converted users + roles + channels resolved within the interaction (Select Menus Only)

Name Type Attributes Description
channels Collection.<Channel> <nullable>

resolved channels

members Collection.<Member> <nullable>

resolved members

roles Collection.<Role> <nullable>

resolved roles

users Collection.<User> <nullable>

resolved users

values Array.<String> <nullable>

The value of the run selected options (Select Menus Only)

guildID String <nullable>

The ID of the guild in which the interaction was created

member Member <nullable>

The member who triggered the interaction (This is only sent when the interaction is invoked within a guild)

message Message <nullable>

The message the interaction came from

user User <nullable>

The user who triggered the interaction (This is only sent when the interaction is invoked within a dm)

Source:

Extends

Methods

(async) acknowledge() → {Promise}

Acknowledges the interaction with a defer message update response

Source:
Returns:
Type:
Promise

(async) createFollowup(content, fileopt) → {Promise.<?Message>}

Respond to the interaction with a followup message

Source:
Parameters:
Name Type Attributes Description
content String | Object

A string or object. If an object is passed:

Name Type Attributes Description
allowedMentions Object <optional>

A list of mentions to allow (overrides default)

Name Type Attributes Description
everyone Boolean <optional>

Whether or not to allow @everyone/@here

roles Boolean | Array.<String> <optional>

Whether or not to allow all role mentions, or an array of specific role mentions to allow

users Boolean | Array.<String> <optional>

Whether or not to allow all user mentions, or an array of specific user mentions to allow

attachments Array.<Object> <optional>

An array of attachment objects with the filename and description

Name Type Attributes Description
description String <optional>

The description of the file

filename String <optional>

The name of the file

id Number

The index of the file

components Array.<Object> <optional>

An array of component objects

Name Type Attributes Description
custom_id String <optional>

The ID of the component (type 2 style 0-4 and type 3,5,6,7,8 only)

disabled Boolean <optional>

Whether the component is disabled (type 2 and 3,5,6,7,8 only)

emoji Object <optional>

The emoji to be displayed in the component (type 2)

label String <optional>

The label to be displayed in the component (type 2)

default_values Array.<Object> <optional>

default values for the component (type 5,6,7,8 only)

Name Type Attributes Description
id String <optional>

id of a user, role, or channel

type String <optional>

type of value that id represents (user, role, or channel)

max_values Number <optional>

The maximum number of items that can be chosen (1-25, default 1)

min_values Number <optional>

The minimum number of items that must be chosen (0-25, default 1)

options Array.<Object> <optional>

The options for this component (type 3 only)

Name Type Attributes Description
default Boolean <optional>

Whether this option should be the default value selected

description String <optional>

The description for this option

emoji Object <optional>

The emoji to be displayed in this option

label String

The label for this option

value Number | String

The value for this option

placeholder String <optional>

The placeholder text for the component when no option is selected (type 3,5,6,7,8 only)

style Number <optional>

The style of the component (type 2 only) - If 0-4, custom_id is required; if 5, url is required

type Number

The type of component - If 1, it is a collection and a components array (nested) is required; if 2, it is a button; if 3, it is a string select; if 5, it is a user select; if 6, it is a role select; if 7, it is a mentionable select; if 8, it is a channel select

url String <optional>

The URL that the component should open for users (type 2 style 5 only)

content String <optional>

A content string

embed Object <optional>

[DEPRECATED] An embed object. See the official Discord API documentation entry for object structure

options.embeds Array.<Object> <optional>

An array of embed objects. See the official Discord API documentation entry for object structure

content.flags Number <optional>

64 for Ephemeral

content.poll Object <optional>

A poll object. See the official Discord API documentation entry for object structure

content.tts Boolean <optional>

Set the message TTS flag

file Object | Array.<Object> <optional>

A file object (or an Array of them)

Name Type Description
file Buffer

A buffer containing file data

name String

What to name the file

Returns:
Type:
Promise.<?Message>

(async) createMessage(content, fileopt) → {Promise}

Acknowledges the interaction with a message. If already acknowledged runs createFollowup

Source:
Parameters:
Name Type Attributes Description
content String | Object

A string or object. If an object is passed:

Name Type Attributes Description
allowedMentions Object <optional>

A list of mentions to allow (overrides default)

Name Type Attributes Description
everyone Boolean <optional>

Whether or not to allow @everyone/@here

roles Boolean | Array.<String> <optional>

Whether or not to allow all role mentions, or an array of specific role mentions to allow

users Boolean | Array.<String> <optional>

Whether or not to allow all user mentions, or an array of specific user mentions to allow

attachments Array.<Object> <optional>

An array of attachment objects with the filename and description

Name Type Attributes Description
description String <optional>

The description of the file

filename String <optional>

The name of the file

id Number

The index of the file

components Array.<Object> <optional>

An array of component objects

Name Type Attributes Description
custom_id String <optional>

The ID of the component (type 2 style 0-4 and type 3,5,6,7,8 only)

disabled Boolean <optional>

Whether the component is disabled (type 2 and 3,5,6,7,8 only)

emoji Object <optional>

The emoji to be displayed in the component (type 2)

label String <optional>

The label to be displayed in the component (type 2)

default_values Array.<Object> <optional>

default values for the component (type 5,6,7,8 only)

Name Type Attributes Description
id String <optional>

id of a user, role, or channel

type String <optional>

type of value that id represents (user, role, or channel)

max_values Number <optional>

The maximum number of items that can be chosen (1-25, default 1)

min_values Number <optional>

The minimum number of items that must be chosen (0-25, default 1)

options Array.<Object> <optional>

The options for this component (type 3 only)

Name Type Attributes Description
default Boolean <optional>

Whether this option should be the default value selected

description String <optional>

The description for this option

emoji Object <optional>

The emoji to be displayed in this option

label String

The label for this option

value Number | String

The value for this option

placeholder String <optional>

The placeholder text for the component when no option is selected (type 3,5,6,7,8 only)

style Number <optional>

The style of the component (type 2 only) - If 0-4, custom_id is required; if 5, url is required

type Number

The type of component - If 1, it is a collection and a components array (nested) is required; if 2, it is a button; if 3, it is a string select; if 5, it is a user select; if 6, it is a role select; if 7, it is a mentionable select; if 8, it is a channel select

url String <optional>

The URL that the component should open for users (type 2 style 5 only)

content String <optional>

A content string

embed Object <optional>

[DEPRECATED] An embed object. See the official Discord API documentation entry for object structure

embeds Array.<Object> <optional>

An array of embed objects. See the official Discord API documentation entry for object structure

flags Number <optional>

64 for Ephemeral

poll Object <optional>

A poll object. See the official Discord API documentation entry for object structure

tts Boolean <optional>

Set the message TTS flag

file Object | Array.<Object> <optional>

A file object (or an Array of them)

Name Type Description
file Buffer

A buffer containing file data

name String

What to name the file

Returns:
Type:
Promise

(async) createModal(content) → {Promise}

Responds to an interaction with a modal

Source:
Parameters:
Name Type Description
content Object

An object

Name Type Attributes Description
title String <optional>

The title for the modal, max 45 characters

custom_id String <optional>

The custom identifier for the modal

components Array.<Object> <optional>

An array of component objects

Name Type Attributes Description
custom_id String <optional>

The ID of the component (type 2 style 0-4 and type 3 only)

disabled Boolean <optional>

Whether the component is disabled (type 2 and 3 only)

emoji Object <optional>

The emoji to be displayed in the component (type 2)

label String <optional>

The label to be displayed in the component (type 2)

max_values Number <optional>

The maximum number of items that can be chosen (1-25, default 1)

min_values Number <optional>

The minimum number of items that must be chosen (0-25, default 1)

options Array.<Object> <optional>

The options for this component (type 3 only)

Name Type Attributes Description
default Boolean <optional>

Whether this option should be the default value selected

description String <optional>

The description for this option

emoji Object <optional>

The emoji to be displayed in this option

label String

The label for this option

value Number | String

The value for this option

placeholder String <optional>

The placeholder text for the component when no option is selected (type 3 only)

style Number <optional>

The style of the component (type 2 only) - If 0-4, custom_id is required; if 5, url is required

type Number

The type of component - If 1, it is a collection and a components array (nested) is required; if 2, it is a button; if 3, it is a select menu

url String <optional>

The URL that the component should open for users (type 2 style 5 only)

Returns:
Type:
Promise

(async) defer(flagsopt) → {Promise}

Acknowledges the interaction with a defer response Note: You can not use more than 1 initial interaction response per interaction

Source:
Parameters:
Name Type Attributes Description
flags Number <optional>

64 for Ephemeral

Returns:
Type:
Promise

(async) deferUpdate() → {Promise}

Acknowledges the interaction with a defer message update response Note: You can not use more than 1 initial interaction response per interaction

Source:
Returns:
Type:
Promise

(async) deleteMessage(messageID) → {Promise}

Delete a message

Source:
Parameters:
Name Type Description
messageID String

the id of the message to delete, or "@original" for the original response

Returns:
Type:
Promise

(async) deleteOriginalMessage() → {Promise}

Delete the parent message Warning: Will error with ephemeral messages.

Source:
Returns:
Type:
Promise

(async) editMessage(messageID, content, fileopt) → {Promise.<Message>}

Edit a message

Source:
Parameters:
Name Type Attributes Description
messageID String

the id of the message to edit, or "@original" for the original response

content Object

Interaction message edit options

Name Type Attributes Description
allowedMentions Object <optional>

A list of mentions to allow (overrides default)

Name Type Attributes Description
everyone Boolean <optional>

Whether or not to allow @everyone/@here

repliedUser Boolean <optional>

Whether or not to mention the author of the message being replied to

roles Boolean | Array.<String> <optional>

Whether or not to allow all role mentions, or an array of specific role mentions to allow

users Boolean | Array.<String> <optional>

Whether or not to allow all user mentions, or an array of specific user mentions to allow

attachments Array.<Object> <optional>

An array of attachment objects that will be appended to the message, including new files. Only the provided files will be appended

Name Type Attributes Description
description String <optional>

The description of the file

filename String <optional>

The name of the file. This is not required if you are attaching a new file

id Number | String

The ID of the file. If you are attaching a new file, this would be the index of the file

components Array.<Object> <optional>

An array of component objects

Name Type Attributes Description
custom_id String <optional>

The ID of the component (type 2 style 0-4 and type 3,5,6,7,8 only)

disabled Boolean <optional>

Whether the component is disabled (type 2 and 3,5,6,7,8 only)

emoji Object <optional>

The emoji to be displayed in the component (type 2)

label String <optional>

The label to be displayed in the component (type 2)

default_values Array.<Object> <optional>

default values for the component (type 5,6,7,8 only)

Name Type Attributes Description
id String <optional>

id of a user, role, or channel

type String <optional>

type of value that id represents (user, role, or channel)

max_values Number <optional>

The maximum number of items that can be chosen (1-25, default 1)

min_values Number <optional>

The minimum number of items that must be chosen (0-25, default 1)

options Array.<Object> <optional>

The options for this component (type 3 only)

Name Type Attributes Description
default Boolean <optional>

Whether this option should be the default value selected

description String <optional>

The description for this option

emoji Object <optional>

The emoji to be displayed in this option

label String

The label for this option

value Number | String

The value for this option

placeholder String <optional>

The placeholder text for the component when no option is selected (type 3,5,6,7,8 only)

style Number <optional>

The style of the component (type 2 only) - If 0-4, custom_id is required; if 5, url is required

type Number

The type of component - If 1, it is a collection and a components array (nested) is required; if 2, it is a button; if 3, it is a string select; if 5, it is a user select; if 6, it is a role select; if 7, it is a mentionable select; if 8, it is a channel select

url String <optional>

The URL that the component should open for users (type 2 style 5 only)

content String <optional>

A content string

embed Object <optional>

[DEPRECATED] An embed object. See the official Discord API documentation entry for object structure

embeds Array.<Object> <optional>

An array of embed objects. See the official Discord API documentation entry for object structure

poll Object <optional>

A poll object. See the official Discord API documentation entry for object structure. Polls can only be added when editing a deferred interaction response

file Object | Array.<Object> <optional>

A file object (or an Array of them)

Name Type Description
file Buffer

A buffer containing file data

name String

What to name the file

Returns:
Type:
Promise.<Message>

(async) editOriginalMessage(content, fileopt) → {Promise.<Message>}

Edit the parent message

Source:
Parameters:
Name Type Attributes Description
content Object

Interaction message edit options

Name Type Attributes Description
allowedMentions Object <optional>

A list of mentions to allow (overrides default)

Name Type Attributes Description
everyone Boolean <optional>

Whether or not to allow @everyone/@here

repliedUser Boolean <optional>

Whether or not to mention the author of the message being replied to

roles Boolean | Array.<String> <optional>

Whether or not to allow all role mentions, or an array of specific role mentions to allow

users Boolean | Array.<String> <optional>

Whether or not to allow all user mentions, or an array of specific user mentions to allow

attachments Array.<Object> <optional>

An array of attachment objects that will be appended to the message, including new files. Only the provided files will be appended

Name Type Attributes Description
description String <optional>

The description of the file

filename String <optional>

The name of the file. This is not required if you are attaching a new file

id Number | String

The ID of the file. If you are attaching a new file, this would be the index of the file

components Array.<Object> <optional>

An array of component objects

Name Type Attributes Description
custom_id String <optional>

The ID of the component (type 2 style 0-4 and type 3,5,6,7,8 only)

disabled Boolean <optional>

Whether the component is disabled (type 2 and 3,5,6,7,8 only)

emoji Object <optional>

The emoji to be displayed in the component (type 2)

label String <optional>

The label to be displayed in the component (type 2)

default_values Array.<Object> <optional>

default values for the component (type 5,6,7,8 only)

Name Type Attributes Description
id String <optional>

id of a user, role, or channel

type String <optional>

type of value that id represents (user, role, or channel)

max_values Number <optional>

The maximum number of items that can be chosen (1-25, default 1)

min_values Number <optional>

The minimum number of items that must be chosen (0-25, default 1)

options Array.<Object> <optional>

The options for this component (type 3 only)

Name Type Attributes Description
default Boolean <optional>

Whether this option should be the default value selected

description String <optional>

The description for this option

emoji Object <optional>

The emoji to be displayed in this option

label String

The label for this option

value Number | String

The value for this option

placeholder String <optional>

The placeholder text for the component when no option is selected (type 3,5,6,7,8 only)

style Number <optional>

The style of the component (type 2 only) - If 0-4, custom_id is required; if 5, url is required

type Number

The type of component - If 1, it is a collection and a components array (nested) is required; if 2, it is a button; if 3, it is a string select; if 5, it is a user select; if 6, it is a role select; if 7, it is a mentionable select; if 8, it is a channel select

url String <optional>

The URL that the component should open for users (type 2 style 5 only)

content String <optional>

A content string

embed Object <optional>

[DEPRECATED] An embed object. See the official Discord API documentation entry for object structure

embeds Array.<Object> <optional>

An array of embed objects. See the official Discord API documentation entry for object structure

poll Object <optional>

A poll object. See the official Discord API documentation entry for object structure. Polls can only be added when editing a deferred interaction response

file Object | Array.<Object> <optional>

A file object (or an Array of them)

Name Type Description
file Buffer

A buffer containing file data

name String

What to name the file

Returns:
Type:
Promise.<Message>

(async) editParent(content, fileopt) → {Promise}

Acknowledges the interaction by editing the parent message. If already acknowledged runs editOriginalMessage Note: You can not use more than 1 initial interaction response per interaction, use edit if you have already responded with a different interaction response Warning: Will error with ephemeral messages.

Source:
Parameters:
Name Type Attributes Description
content String | Object

What to edit the message with

Name Type Attributes Description
allowedMentions Object <optional>

A list of mentions to allow (overrides default)

Name Type Attributes Description
everyone Boolean <optional>

Whether or not to allow @everyone/@here

repliedUser Boolean <optional>

Whether or not to mention the author of the message being replied to.

roles Boolean | Array.<String> <optional>

Whether or not to allow all role mentions, or an array of specific role mentions to allow

users Boolean | Array.<String> <optional>

Whether or not to allow all user mentions, or an array of specific user mentions to allow

attachments Array.<Object> <optional>

An array of attachment objects that will be appended to the message, including new files. Only the provided files will be appended

Name Type Attributes Description
description String <optional>

The description of the file

filename String <optional>

The name of the file. This is not required if you are attaching a new file

id Number | String

The ID of the file. If you are attaching a new file, this would be the index of the file

components Array.<Object> <optional>

An array of component objects

Name Type Attributes Description
custom_id String <optional>

The ID of the component (type 2 style 0-4 and type 3,5,6,7,8 only)

disabled Boolean <optional>

Whether the component is disabled (type 2 and 3,5,6,7,8 only)

emoji Object <optional>

The emoji to be displayed in the component (type 2)

label String <optional>

The label to be displayed in the component (type 2)

default_values Array.<Object> <optional>

default values for the component (type 5,6,7,8 only)

Name Type Attributes Description
id String <optional>

id of a user, role, or channel

type String <optional>

type of value that id represents (user, role, or channel)

max_values Number <optional>

The maximum number of items that can be chosen (1-25, default 1)

min_values Number <optional>

The minimum number of items that must be chosen (0-25, default 1)

options Array.<Object> <optional>

The options for this component (type 3 only)

Name Type Attributes Description
default Boolean <optional>

Whether this option should be the default value selected

description String <optional>

The description for this option

emoji Object <optional>

The emoji to be displayed in this option

label String

The label for this option

value Number | String

The value for this option

placeholder String <optional>

The placeholder text for the component when no option is selected (type 3,5,6,7,8 only)

style Number <optional>

The style of the component (type 2 only) - If 0-4, custom_id is required; if 5, url is required

type Number

The type of component - If 1, it is a collection and a components array (nested) is required; if 2, it is a button; if 3, it is a string select; if 5, it is a user select; if 6, it is a role select; if 7, it is a mentionable select; if 8, it is a channel select

url String <optional>

The URL that the component should open for users (type 2 style 5 only)

content String <optional>

A content string

embed Object <optional>

[DEPRECATED] An embed object. See the official Discord API documentation entry for object structure

embeds Array.<Object> <optional>

An array of embed objects. See the official Discord API documentation entry for object structure

flags Number <optional>

64 for Ephemeral

tts Boolean <optional>

Set the message TTS flag

file Object | Array.<Object> <optional>

A file object (or an Array of them)

Name Type Description
file Buffer

A buffer containing file data

name String

What to name the file

Returns:
Type:
Promise

(async) getOriginalMessage() → {Promise.<Message>}

Get the parent message Warning: Will error with ephemeral messages

Source:
Returns:
Type:
Promise.<Message>