Modal
Implementation of the Discord Modal Interaction class in Luau
Summary
Properties
Modal.type :: stringModal.context :: stringModal.id :: stringModal.applicationId :: stringModal.data :: Classes.InteractionBehaviourData?Modal.guild :: Classes.UnavailableGuild?Modal.guildId :: string?Modal.channelId :: string?Modal.member :: Classes.Guild.Member?Modal.user :: Classes.User?Modal.token :: stringModal.version :: numberModal.message :: Classes.Message?Modal.appPermissions :: Classes.PermissionModal.locale :: string?Modal.guildLocale :: string?Modal.entitlements :: {Classes.Entitlement}Modal.authorizingIntegrationOwners :: {[string]: string}Modal.attachmentSizeLimit :: number?Modal.state :: StateModal.id :: stringModal.token :: stringModal.isDeferred :: booleanMethods
Modal:getContent(customId: string) → string?Modal:sync(interactionData: apiTypes.InteractionObject)Modal:deferAsync() → future.FutureLike<string, nil>Modal:messageAsync(messageJSON: builders.messageJSON, responseMessage: boolean?) → future.FutureLike<string, message.Message?>Modal:modalAsync(modalJSON: builders.ModalJSON, responseMessage: boolean?) → future.FutureLike<string, message.Message?>Modal:getResponseAsync(threadId: string?) → future.FutureLike<string, message.Message>Modal:editResponseAsync(messageJSON: builders.messageJSON, threadId: string?) → future.FutureLike<string, message.Message>Modal:deleteResponseAsync() → future.FutureLike<string, nil>Modal:createFollowupResponseAsync(messageJSON: builders.messageJSON, threadId: string?) → future.FutureLike<string, message.Message>Modal:getFollowupResponseAsync(messageId: string, threadId: string?) → future.FutureLike<string, message.Message>Modal:editFollowupResponseAsync(messageId: apiTypes.Snowflake, messageJSON: builders.messageJSON, threadId: string?) → future.FutureLike<string, message.Message>Modal:deleteFollowupResponseAsync(messageId: string) → future.FutureLike<string, nil>Properties
Section titled “Properties”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
context
Section titled “context”The context type of the interaction. This can be one of the following values:
- “GUILD”
- “BOT_DM”
- “PRIVATE_CHANNEL”
Inherited from Classes.Interactions.InteractionBehaviour
The unique identifier for the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
applicationId
Section titled “applicationId”The ID of the application this interaction is for.
Inherited from Classes.Interactions.InteractionBehaviour
The data associated with the interaction. The structure of this data varies based on the interaction type.
Inherited from Classes.Interactions.InteractionBehaviour
The guild where the interaction was triggered. This is only present for guild interactions.
Inherited from Classes.Interactions.InteractionBehaviour
guildId
Section titled “guildId”The ID of the guild where the interaction was triggered. This is only present for guild interactions.
Inherited from Classes.Interactions.InteractionBehaviour
channelId
Section titled “channelId”The ID of the channel where the interaction was triggered.
Inherited from Classes.Interactions.InteractionBehaviour
member
Section titled “member”The member who triggered the interaction. This is only present for guild interactions.
Inherited from Classes.Interactions.InteractionBehaviour
The user who triggered the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
The token used for responding to the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
version
Section titled “version”The version of the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
message
Section titled “message”The message that triggered the interaction. This is only present for message component interactions.
Inherited from Classes.Interactions.InteractionBehaviour
appPermissions
Section titled “appPermissions”The permissions the application has in the channel where the interaction was triggered.
Inherited from Classes.Interactions.InteractionBehaviour
locale
Section titled “locale”The selected language of the user who triggered the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
guildLocale
Section titled “guildLocale”The guild’s preferred locale, if the interaction was triggered in a guild.
Inherited from Classes.Interactions.InteractionBehaviour
entitlements
Section titled “entitlements”The entitlements for the user who triggered the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
authorizingIntegrationOwners
Section titled “authorizingIntegrationOwners”{[string]: string} }
The mapping of integration types to their respective owners.
Inherited from Classes.Interactions.InteractionBehaviour
attachmentSizeLimit
Section titled “attachmentSizeLimit”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
The state object for this interaction.
Inherited from Classes.Interactions.Interactable
The ID of the interaction.
Inherited from Classes.Interactions.Interactable
The token for this interaction.
Inherited from Classes.Interactions.Interactable
isDeferred
Section titled “isDeferred”Whether this interaction has been deferred.
Inherited from Classes.Interactions.Interactable
Methods
Section titled “Methods”getContent
Section titled “getContent”Modal : getContent ( customId ) -> string?
Gets the content of a text input component with the specified custom ID.
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 |
deferAsync
Section titled “deferAsync”Modal : deferAsync ( ) -> FutureLike<string, nil>
Acknowledge an interaction and edit a response later, the user sees a loading state.
Returns
| FutureLike<string, nil> |
Inherited from Classes.Interactions.Interactable
messageAsync
Section titled “messageAsync”Modal : messageAsync ( messageJSON , responseMessage ) -> FutureLike<string, Message?>
Respond to this interaction with a message.
Parameters
| messageJSON: messageJSON | |
| responseMessage: boolean? |
Returns
| FutureLike<string, Message?> |
Inherited from Classes.Interactions.Interactable
modalAsync
Section titled “modalAsync”Modal : modalAsync ( modalJSON , responseMessage ) -> FutureLike<string, Message?>
Respond to this interaction with a modal.
Parameters
| modalJSON: ModalJSON | |
| responseMessage: boolean? |
Returns
| FutureLike<string, Message?> |
Inherited from Classes.Interactions.Interactable
getResponseAsync
Section titled “getResponseAsync”Modal : getResponseAsync ( threadId ) -> FutureLike<string, Message>
Get the response created by this interaction.
Parameters
| threadId: string? |
Returns
| FutureLike<string, Message> |
Inherited from Classes.Interactions.Interactable
editResponseAsync
Section titled “editResponseAsync”Modal : editResponseAsync ( messageJSON , threadId ) -> FutureLike<string, Message>
Edit the response made by this interaction.
Parameters
| messageJSON: messageJSON | |
| threadId: string? |
Returns
| FutureLike<string, Message> |
Inherited from Classes.Interactions.Interactable
deleteResponseAsync
Section titled “deleteResponseAsync”Modal : deleteResponseAsync ( ) -> FutureLike<string, nil>
Delete the original response made by this interaction.
Returns
| FutureLike<string, nil> |
Inherited from Classes.Interactions.Interactable
createFollowupResponseAsync
Section titled “createFollowupResponseAsync”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? |
Returns
| FutureLike<string, Message> |
Inherited from Classes.Interactions.Interactable
getFollowupResponseAsync
Section titled “getFollowupResponseAsync”Modal : getFollowupResponseAsync ( messageId , threadId ) -> FutureLike<string, Message>
Get the followup response created by this interaction.
Returns
| FutureLike<string, Message> |
Inherited from Classes.Interactions.Interactable
editFollowupResponseAsync
Section titled “editFollowupResponseAsync”Modal : editFollowupResponseAsync ( messageId , messageJSON , threadId ) -> FutureLike<string, Message>
Edit the followup response created by this interaction.
Parameters
| messageId: Snowflake | |
| messageJSON: messageJSON | |
| threadId: string? |
Returns
| FutureLike<string, Message> |
Inherited from Classes.Interactions.Interactable
deleteFollowupResponseAsync
Section titled “deleteFollowupResponseAsync”Modal : deleteFollowupResponseAsync ( messageId ) -> FutureLike<string, nil>
Delete the followup response created by this interaction.
Parameters
| messageId: string |
Returns
| FutureLike<string, nil> |
Inherited from Classes.Interactions.Interactable
Functions
Section titled “Functions”Modal . new ( state , interactionData ) -> Modal
Responsible for constructing this class.
Parameters
| state: State | |
| interactionData: InteractionObject |
Returns
| Modal |
inheritProperties
Section titled “inheritProperties”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
inheritMethods
Section titled “inheritMethods”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
inheritProperties
Section titled “inheritProperties”Modal . inheritProperties ( ) -> ()
Inherit properties from the Interaction class.
Inherited from Classes.Interactions.Interactable
inheritMethods
Section titled “inheritMethods”Modal . inheritMethods ( class ) -> ()
Inherit methods from the Interaction class.
Parameters
| class: any |
Inherited from Classes.Interactions.Interactable