ModalComponentResolver
Class: ModalComponentResolver
Section titled “Class: ModalComponentResolver”Defined in: resolvers/ModalComponentResolver.ts:65
Resolves field values from a modal submission by custom ID, with entity lookups (users, members,
roles, channels, attachments) already resolved. Available as interaction.fields on ModalInteraction.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ModalComponentResolver(
components,resolved?):ModalComponentResolver
Defined in: resolvers/ModalComponentResolver.ts:69
Parameters
Section titled “Parameters”components
Section titled “components”(ModalSubmitLabelComponent | ModalSubmitTextDisplayComponent)[]
resolved?
Section titled “resolved?”APIInteractionDataResolved
Returns
Section titled “Returns”ModalComponentResolver
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get data():
APIModalData[]
Defined in: resolvers/ModalComponentResolver.ts:101
Returns
Section titled “Returns”Methods
Section titled “Methods”fieldExists()
Section titled “fieldExists()”fieldExists(
custom_id):boolean
Defined in: resolvers/ModalComponentResolver.ts:110
Checks if a component with the given custom ID exists in the modal.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component to check for.
Returns
Section titled “Returns”boolean
True if a component with the given custom ID exists, false otherwise.
getAllComponents()
Section titled “getAllComponents()”getAllComponents():
APIModalData[]
Defined in: resolvers/ModalComponentResolver.ts:357
Returns the resolved data for every component in the modal.
Returns
Section titled “Returns”getCheckboxGroupValues()
Section titled “getCheckboxGroupValues()”Call Signature
Section titled “Call Signature”getCheckboxGroupValues(
custom_id,required?):string[] |null
Defined in: resolvers/ModalComponentResolver.ts:329
Gets the checked values of a checkbox group component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a checkbox group.
Returns
Section titled “Returns”string[] | null
The checked values, or null if not set and not required.
Call Signature
Section titled “Call Signature”getCheckboxGroupValues(
custom_id,required):string[]
Defined in: resolvers/ModalComponentResolver.ts:330
Gets the checked values of a checkbox group component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a checkbox group.
Returns
Section titled “Returns”string[]
The checked values, or null if not set and not required.
getCheckboxValue()
Section titled “getCheckboxValue()”Call Signature
Section titled “Call Signature”getCheckboxValue(
custom_id,required?):boolean|null
Defined in: resolvers/ModalComponentResolver.ts:346
Gets the checked state of a checkbox component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a checkbox.
Returns
Section titled “Returns”boolean | null
The checked state, or null if not set and not required.
Call Signature
Section titled “Call Signature”getCheckboxValue(
custom_id,required):boolean
Defined in: resolvers/ModalComponentResolver.ts:347
Gets the checked state of a checkbox component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a checkbox.
Returns
Section titled “Returns”boolean
The checked state, or null if not set and not required.
getComponent()
Section titled “getComponent()”getComponent(
custom_id):APIModalData
Defined in: resolvers/ModalComponentResolver.ts:120
Gets a component’s resolved data by its custom ID.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component to get.
Returns
Section titled “Returns”Throws
Section titled “Throws”If no component with the given custom ID exists.
getFiles()
Section titled “getFiles()”Call Signature
Section titled “Call Signature”getFiles(
custom_id,required?):Collection<string,APIAttachment> |null
Defined in: resolvers/ModalComponentResolver.ts:290
Gets the uploaded files from a file upload component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a file upload.
Returns
Section titled “Returns”Collection<string, APIAttachment> | null
The uploaded files, or null if not set and not required.
Call Signature
Section titled “Call Signature”getFiles(
custom_id,required):Collection<string,APIAttachment>
Defined in: resolvers/ModalComponentResolver.ts:291
Gets the uploaded files from a file upload component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a file upload.
Returns
Section titled “Returns”Collection<string, APIAttachment>
The uploaded files, or null if not set and not required.
getRadioGroupValue()
Section titled “getRadioGroupValue()”Call Signature
Section titled “Call Signature”getRadioGroupValue(
custom_id,required?):string|null
Defined in: resolvers/ModalComponentResolver.ts:312
Gets the selected value of a radio group component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a radio group.
Returns
Section titled “Returns”string | null
The selected value, or null if not set and not required.
Call Signature
Section titled “Call Signature”getRadioGroupValue(
custom_id,required):string
Defined in: resolvers/ModalComponentResolver.ts:313
Gets the selected value of a radio group component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a radio group.
Returns
Section titled “Returns”string
The selected value, or null if not set and not required.
getSelectedChannels()
Section titled “getSelectedChannels()”Call Signature
Section titled “Call Signature”getSelectedChannels(
custom_id,required?):Collection<string,APIInteractionDataResolvedChannel> |null
Defined in: resolvers/ModalComponentResolver.ts:169
Gets the selected channels from a channel select menu.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a channel select.
Returns
Section titled “Returns”Collection<string, APIInteractionDataResolvedChannel> | null
The selected channels, or null if not set and not required.
Call Signature
Section titled “Call Signature”getSelectedChannels(
custom_id,required):Collection<string,APIInteractionDataResolvedChannel>
Defined in: resolvers/ModalComponentResolver.ts:170
Gets the selected channels from a channel select menu.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a channel select.
Returns
Section titled “Returns”Collection<string, APIInteractionDataResolvedChannel>
The selected channels, or null if not set and not required.
getSelectedMembers()
Section titled “getSelectedMembers()”Call Signature
Section titled “Call Signature”getSelectedMembers(
custom_id,required?):Collection<string,ResolvedSelectedGuildMember> |null
Defined in: resolvers/ModalComponentResolver.ts:214
Gets the selected members from a user select menu (if in guild).
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a user select.
Returns
Section titled “Returns”Collection<string, ResolvedSelectedGuildMember> | null
The selected members, or null if not set and not required.
Call Signature
Section titled “Call Signature”getSelectedMembers(
custom_id,required):Collection<string,ResolvedSelectedGuildMember>
Defined in: resolvers/ModalComponentResolver.ts:215
Gets the selected members from a user select menu (if in guild).
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a user select.
Returns
Section titled “Returns”Collection<string, ResolvedSelectedGuildMember>
The selected members, or null if not set and not required.
getSelectedMentionables()
Section titled “getSelectedMentionables()”Call Signature
Section titled “Call Signature”getSelectedMentionables(
custom_id,required?): (APIRole|APIUser|ResolvedSelectedGuildMember)[] |null
Defined in: resolvers/ModalComponentResolver.ts:256
Gets the selected mentionables from a mentionable select menu.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a mentionable select.
Returns
Section titled “Returns”(APIRole | APIUser | ResolvedSelectedGuildMember)[] | null
The selected mentionables (users, members, or roles), or null if not set and not required.
Call Signature
Section titled “Call Signature”getSelectedMentionables(
custom_id,required): (APIRole|APIUser|ResolvedSelectedGuildMember)[]
Defined in: resolvers/ModalComponentResolver.ts:257
Gets the selected mentionables from a mentionable select menu.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a mentionable select.
Returns
Section titled “Returns”(APIRole | APIUser | ResolvedSelectedGuildMember)[]
The selected mentionables (users, members, or roles), or null if not set and not required.
getSelectedRoles()
Section titled “getSelectedRoles()”Call Signature
Section titled “Call Signature”getSelectedRoles(
custom_id,required?):Collection<string,APIRole> |null
Defined in: resolvers/ModalComponentResolver.ts:237
Gets the selected roles from a role select menu.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a role select.
Returns
Section titled “Returns”Collection<string, APIRole> | null
The selected roles, or null if not set and not required.
Call Signature
Section titled “Call Signature”getSelectedRoles(
custom_id,required):Collection<string,APIRole>
Defined in: resolvers/ModalComponentResolver.ts:238
Gets the selected roles from a role select menu.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a role select.
Returns
Section titled “Returns”Collection<string, APIRole>
The selected roles, or null if not set and not required.
getSelectedUsers()
Section titled “getSelectedUsers()”Call Signature
Section titled “Call Signature”getSelectedUsers(
custom_id,required?):Collection<string,APIUser> |null
Defined in: resolvers/ModalComponentResolver.ts:195
Gets the selected users from a user select menu.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a user select.
Returns
Section titled “Returns”Collection<string, APIUser> | null
The selected users, or null if not set and not required.
Call Signature
Section titled “Call Signature”getSelectedUsers(
custom_id,required):Collection<string,APIUser>
Defined in: resolvers/ModalComponentResolver.ts:196
Gets the selected users from a user select menu.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a user select.
Returns
Section titled “Returns”Collection<string, APIUser>
The selected users, or null if not set and not required.
getSelectedValues()
Section titled “getSelectedValues()”Call Signature
Section titled “Call Signature”getSelectedValues(
custom_id,required?): readonlystring[] |null
Defined in: resolvers/ModalComponentResolver.ts:152
Gets the selected values of a select menu component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a select menu.
Returns
Section titled “Returns”readonly string[] | null
The selected values, or null if not set and not required.
Call Signature
Section titled “Call Signature”getSelectedValues(
custom_id,required): readonlystring[]
Defined in: resolvers/ModalComponentResolver.ts:153
Gets the selected values of a select menu component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a select menu.
Returns
Section titled “Returns”readonly string[]
The selected values, or null if not set and not required.
getString()
Section titled “getString()”Call Signature
Section titled “Call Signature”getString(
custom_id,required?):string|null
Defined in: resolvers/ModalComponentResolver.ts:135
Gets the value of a text input component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required?
Section titled “required?”boolean
Whether to throw an error if the component is not found or not a text input.
Returns
Section titled “Returns”string | null
The value of the text input, or null if not set and not required.
Call Signature
Section titled “Call Signature”getString(
custom_id,required):string
Defined in: resolvers/ModalComponentResolver.ts:136
Gets the value of a text input component.
Parameters
Section titled “Parameters”custom_id
Section titled “custom_id”string
The custom ID of the component.
required
Section titled “required”true
Whether to throw an error if the component is not found or not a text input.
Returns
Section titled “Returns”string
The value of the text input, or null if not set and not required.
