ComponentInteraction - BestMordaEver/Discordia GitHub Wiki

Represents an interaction that your application receives when a user uses a message component.

Instances of this class should not be constructed by users.

Properties Inherited From MessagingInteraction

Name Type Description
channel TextChannel The channel in which this interaction happened.
client Client A shortcut to the client object to which this container is visible.
createdAt number The Unix time in seconds at which this object was created by Discord. Additional decimal points may be present, though only the first 3 (milliseconds) should be considered accurate. Equivalent to Date.parseSnowflake(Snowflake.id).
guild Guild/nil The guild in which this interaction happened. This will not exist if the interaction was not sent in a guild text channel. Equivalent to Interaction.channel.guild.
guild_locale string/nil The guild's preferred locale, if invoked in a guild.
id string The Snowflake ID that can be used to identify the object. This is guaranteed to be unique except in cases where an object shares the ID of its parent.
locale string The selected language of the invoking user.
member Member/nil The member object of the interaction user. This will not exist if the interaction was not sent in a guild text channel or if the member object is not cached. Equivalent to Interaction.guild.members:get(Interaction.author.id).
parent Container/Client The parent object of to which this container is a child. For example, the parent of a role is the guild in which the role exists.
timestamp string The date and time at which this object was created by Discord, represented as an ISO 8601 string plus microseconds when available. Equivalent to Date.fromSnowflake(Snowflake.id):toISO().
token string A continuation token for responding to the interaction. Valid for 15 minutes.
type number The interaction type. See the interactionType enumeration for a human-readable representation.
user User The object of the user that created the interaction.

Properties

Name Type Description
componentType number The component type. See the componentType enumeration for a human-readable representation.
customId string Developer defined custom ID for this component.
message Message The message on which this component exists.
values table/nil Array of select option values. This will exist only for select menu components.

Methods Inherited From MessagingInteraction

__eq()

Defines the behavior of the == operator. Allows containers to be directly compared according to their type and __hash return values.

Returns: boolean


__hash()

Returns Snowflake.id

Returns: string


__tostring()

Defines the behavior of the tostring function. All containers follow the format ClassName: hash.

Returns: string


createModal(id, title, components)

Parameter Type
id string
title string
components table

Acknowledge the interaction and respond with a popup modal. Components must be an array of 1-5 message components

This method always makes an HTTP request.

Returns: Message


deferReply(ephemeral)

Parameter Type Optional
ephemeral boolean

Acknowledge the interaction and edit the response later. The user will see the loading state. In order to resolve the loading state, use MessagingInteraction:updateReply(content) method.

This method always makes an HTTP request.

Returns: boolean


followup(content)

Parameter Type
content string/table

Send a followup message. If content is a string, then this is simply sent as the message content. If it is a table, more advanced formatting is allowed. See managing messages for more information. You must first reply or acknowledge the interaction before following up!

This method always makes an HTTP request.

Returns: Message


getDate()

Returns a unique Date object that represents when the object was created by Discord. Equivalent to Date.fromSnowflake(Snowflake.id)

This method only operates on data in memory.

Returns: Date


getFollowupMessage(id)

Parameter Type
id Message-ID-Resolvable

Gets a folloup message object by ID. If the object is already cached, then the cached object will be returned; otherwise, an HTTP request is made. Does not support ephemeral followups.

This method always makes an HTTP request.

Returns: Message


getReply()

Get the message object that was sent as the initial reply.

This method always makes an HTTP request.

Returns: Message


reply(content)

Parameter Type
content string/table

Reply to interaction with a message. If content is a string, then this is simply sent as the message content. If it is a table, more advanced formatting is allowed. See managing messages for more information. This method doesn't return sent message.

This method always makes an HTTP request.

Returns: boolean


updateFollowup(content)

Parameter Type
content string/table

Set content of the followup message simmilarly to Message:update(data). Does not support ephemeral followups.

This method always makes an HTTP request.

Returns: Message


updateReply(content)

Parameter Type
content string/table

Set content of the message object that was sent as the initial reply simmilarly to Message:update(data).

This method always makes an HTTP request.

Returns: Message


Methods

deferUpdate()

Acknowledge the interaction and update the message that the component is attached to later. The user won't see a loading state.

This method always makes an HTTP request.

Returns: boolean


update(content)

Parameter Type
content string/table

Acknowledge the interaction and update the message that the component is attached to. If content is a string, then it is simply set as the message content. If it is a table, more advanced formatting is allowed. See managing messages for more information.

This method always makes an HTTP request.

Returns: boolean


⚠️ **GitHub.com Fallback** ⚠️