Skip to content

ModalInteraction

ModalInteraction ⇐ MessageComponentInteraction

Kind: global class
Extends: MessageComponentInteraction

new ModalInteraction([data], guildId, client)

Constructs a new instance of the Input_Text component.

ParamTypeDescription
[data]ObjectThe data object for the interaction.
guildIdstringThe ID of the guild where the interaction occurred.
clientClientThe client instance.

modalInteraction.getTextInput(customId, [required]) ⇒ string | null

Retrieves the value of a text input field with the specified custom ID.

Kind: instance method of ModalInteraction
Returns: string | null - The value of the text input field, or null if the field is not found and not required.
Throws:

  • RangeError If the specified custom ID is not found or if the field is not of type “Input_Text”.
ParamTypeDefaultDescription
customIdstringThe custom ID of the text input field.
[required]booleanfalseIndicates whether the text input field is required. If set to true and the field is not found, a RangeError will be thrown.

modalInteraction.getSelect(customId, [required]) ⇒ Array.<string> | null

Retrieves the values of a Select component with the specified custom ID.

Kind: instance method of ModalInteraction
Returns: Array.<string> | null - - The values of the Select component, or null if not found and not required.
Throws:

  • RangeError - If the Select component is not found and is required, or if the mode type selected is not String_Select.
ParamTypeDefaultDescription
customIdstringThe custom ID of the Select component.
[required]booleanfalseIndicates whether the Select component is required.

ModalInteraction.transformResolvedFields(fields) ⇒ Object

Transforms the resolved fields object by converting the “type” property from a number to its corresponding string value from the ComponentType enum. Also, maps the “components” array and transforms each object by converting the “type” property from a number to its corresponding string value from the ComponentType enum.

Kind: static method of ModalInteraction
Returns: Object - - The transformed fields object.

ParamTypeDescription
fieldsObjectThe resolved fields object to transform.