Skip to content

Modal

Implementation of the Discord Modal Interaction class in Luau

https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure

Summary

Modal.type  :: string

The type of interaction. This can be one of the following values:

  • “PING”
  • “APPLICATION_COMMAND”
  • “MESSAGE_COMPONENT”
  • “APPLICATION_COMMAND_AUTOCOMPLETE”
  • “MODAL_SUBMIT”

Inherited from Classes.Interactions.InteractionBehaviour

Modal.context  :: string

The context type of the interaction. This can be one of the following values:

  • “GUILD”
  • “BOT_DM”
  • “PRIVATE_CHANNEL”

Inherited from Classes.Interactions.InteractionBehaviour

Modal.id  :: string

The unique identifier for the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.applicationId  :: string

The ID of the application this interaction is for.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.data  :: InteractionBehaviourData?

The data associated with the interaction. The structure of this data varies based on the interaction type.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.guild  :: UnavailableGuild?

The guild where the interaction was triggered. This is only present for guild interactions.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.guildId  :: string?

The ID of the guild where the interaction was triggered. This is only present for guild interactions.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.channelId  :: string?

The ID of the channel where the interaction was triggered.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.member  :: Member?

The member who triggered the interaction. This is only present for guild interactions.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.user  :: User?

The user who triggered the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.token  :: string

The token used for responding to the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.version  :: number

The version of the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.message  :: Message?

The message that triggered the interaction. This is only present for message component interactions.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.appPermissions  :: Permission

The permissions the application has in the channel where the interaction was triggered.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.locale  :: string?

The selected language of the user who triggered the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.guildLocale  :: string?

The guild’s preferred locale, if the interaction was triggered in a guild.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.entitlements  :: Entitlement}

The entitlements for the user who triggered the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.authorizingIntegrationOwners  :: {
{[string]: string} }

The mapping of integration types to their respective owners.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.attachmentSizeLimit  :: number?

The maximum attachment size in bytes for this interaction, varies by guild boost tier and the invoking user’s Nitro status.

Inherited from Classes.Interactions.InteractionBehaviour

Modal.state  :: State

The state object for this interaction.

Inherited from Classes.Interactions.Interactable

Modal.id  :: string

The ID of the interaction.

Inherited from Classes.Interactions.Interactable

Modal.token  :: string

The token for this interaction.

Inherited from Classes.Interactions.Interactable

Modal.isDeferred  :: boolean

Whether this interaction has been deferred.

Inherited from Classes.Interactions.Interactable

Modal : getContent ( customId )  -> string?

Gets the content of a text input component with the specified custom ID.

Parameters

customId: string

Returns

string?
Modal : sync ( interactionData )  -> ()

Responsible for syncing data to this modal interaction object. This is typically called by the API when this object is created or updated.

Parameters

interactionData: InteractionObject
Modal : deferAsync ( )  -> FutureLike<string, nil>

Acknowledge an interaction and edit a response later, the user sees a loading state.

Inherited from Classes.Interactions.Interactable

Modal : messageAsync ( messageJSON responseMessage )  -> FutureLike<string, Message?>

Respond to this interaction with a message.

Parameters

messageJSON: messageJSON
responseMessage: boolean?

Inherited from Classes.Interactions.Interactable

Modal : modalAsync ( modalJSON responseMessage )  -> FutureLike<string, Message?>

Respond to this interaction with a modal.

Parameters

modalJSON: ModalJSON
responseMessage: boolean?

Inherited from Classes.Interactions.Interactable

Modal : getResponseAsync ( threadId )  -> FutureLike<string, Message>

Get the response created by this interaction.

Parameters

threadId: string?

Inherited from Classes.Interactions.Interactable

Modal : editResponseAsync ( messageJSON threadId )  -> FutureLike<string, Message>

Edit the response made by this interaction.

Parameters

messageJSON: messageJSON
threadId: string?

Inherited from Classes.Interactions.Interactable

Modal : deleteResponseAsync ( )  -> FutureLike<string, nil>

Delete the original response made by this interaction.

Inherited from Classes.Interactions.Interactable

Modal : createFollowupResponseAsync ( messageJSON threadId )  -> FutureLike<string, Message>

Create a followup response to an interaction, followup responses are messages you can send after the initial response is sent.

Parameters

messageJSON: messageJSON
threadId: string?

Inherited from Classes.Interactions.Interactable

Modal : getFollowupResponseAsync ( messageId threadId )  -> FutureLike<string, Message>

Get the followup response created by this interaction.

Parameters

messageId: string
threadId: string?

Inherited from Classes.Interactions.Interactable

Modal : editFollowupResponseAsync ( messageId messageJSON threadId )  -> FutureLike<string, Message>

Edit the followup response created by this interaction.

Parameters

messageId: Snowflake
messageJSON: messageJSON
threadId: string?

Inherited from Classes.Interactions.Interactable

Modal : deleteFollowupResponseAsync ( messageId )  -> FutureLike<string, nil>

Delete the followup response created by this interaction.

Parameters

messageId: string

Inherited from Classes.Interactions.Interactable

Modal . new ( state interactionData )  -> Modal

Responsible for constructing this class.

Parameters

state: State
interactionData: InteractionObject

Returns

Modal
Modal . inheritProperties ( class interactionData )  -> ()

Responsible for inheriting properties from the interaction data to the class instance. This function initializes all the properties of an Interaction instance based on the provided interaction data.

Parameters

class: any
interactionData: InteractionObject

Inherited from Classes.Interactions.InteractionBehaviour

Modal . inheritMethods ( class )  -> ()

Responsible for inheriting methods from the Interaction prototype to the class instance. This function copies all methods from the Interaction.Prototype to the provided class instance.

Parameters

class: any

Inherited from Classes.Interactions.InteractionBehaviour

Modal . inheritProperties ( )  -> ()

Inherit properties from the Interaction class.

Inherited from Classes.Interactions.Interactable

Modal . inheritMethods ( class )  -> ()

Inherit methods from the Interaction class.

Parameters

class: any

Inherited from Classes.Interactions.Interactable