ModalInteraction
ModalInteraction ⇐ MessageComponentInteraction
Section titled “ModalInteraction ⇐ MessageComponentInteraction”Kind: global class
Extends: MessageComponentInteraction
- ModalInteraction ⇐
MessageComponentInteraction- new ModalInteraction([data], guildId, client)
- instance
- .getTextInput(customId, [required]) ⇒
string|null - .getSelect(customId, [required]) ⇒
Array.<string>|null
- .getTextInput(customId, [required]) ⇒
- static
- .transformResolvedFields(fields) ⇒
Object
- .transformResolvedFields(fields) ⇒
new ModalInteraction([data], guildId, client)
Section titled “new ModalInteraction([data], guildId, client)”Constructs a new instance of the Input_Text component.
| Param | Type | Description |
|---|---|---|
| [data] | Object | The data object for the interaction. |
| guildId | string | The ID of the guild where the interaction occurred. |
| client | Client | The client instance. |
modalInteraction.getTextInput(customId, [required]) ⇒ string | null
Section titled “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:
RangeErrorIf the specified custom ID is not found or if the field is not of type “Input_Text”.
| Param | Type | Default | Description |
|---|---|---|---|
| customId | string | The custom ID of the text input field. | |
| [required] | boolean | false | Indicates 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
Section titled “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.
| Param | Type | Default | Description |
|---|---|---|---|
| customId | string | The custom ID of the Select component. | |
| [required] | boolean | false | Indicates whether the Select component is required. |
ModalInteraction.transformResolvedFields(fields) ⇒ Object
Section titled “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.
| Param | Type | Description |
|---|---|---|
| fields | Object | The resolved fields object to transform. |