Skip to content

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.

new ModalComponentResolver(components, resolved?): ModalComponentResolver

Defined in: resolvers/ModalComponentResolver.ts:69

(ModalSubmitLabelComponent | ModalSubmitTextDisplayComponent)[]

APIInteractionDataResolved

ModalComponentResolver

get data(): APIModalData[]

Defined in: resolvers/ModalComponentResolver.ts:101

APIModalData[]

fieldExists(custom_id): boolean

Defined in: resolvers/ModalComponentResolver.ts:110

Checks if a component with the given custom ID exists in the modal.

string

The custom ID of the component to check for.

boolean

True if a component with the given custom ID exists, false otherwise.


getAllComponents(): APIModalData[]

Defined in: resolvers/ModalComponentResolver.ts:357

Returns the resolved data for every component in the modal.

APIModalData[]


getCheckboxGroupValues(custom_id, required?): string[] | null

Defined in: resolvers/ModalComponentResolver.ts:329

Gets the checked values of a checkbox group component.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a checkbox group.

string[] | null

The checked values, or null if not set and not required.

getCheckboxGroupValues(custom_id, required): string[]

Defined in: resolvers/ModalComponentResolver.ts:330

Gets the checked values of a checkbox group component.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a checkbox group.

string[]

The checked values, or null if not set and not required.


getCheckboxValue(custom_id, required?): boolean | null

Defined in: resolvers/ModalComponentResolver.ts:346

Gets the checked state of a checkbox component.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a checkbox.

boolean | null

The checked state, or null if not set and not required.

getCheckboxValue(custom_id, required): boolean

Defined in: resolvers/ModalComponentResolver.ts:347

Gets the checked state of a checkbox component.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a checkbox.

boolean

The checked state, or null if not set and not required.


getComponent(custom_id): APIModalData

Defined in: resolvers/ModalComponentResolver.ts:120

Gets a component’s resolved data by its custom ID.

string

The custom ID of the component to get.

APIModalData

If no component with the given custom ID exists.


getFiles(custom_id, required?): Collection<string, APIAttachment> | null

Defined in: resolvers/ModalComponentResolver.ts:290

Gets the uploaded files from a file upload component.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a file upload.

Collection<string, APIAttachment> | null

The uploaded files, or null if not set and not required.

getFiles(custom_id, required): Collection<string, APIAttachment>

Defined in: resolvers/ModalComponentResolver.ts:291

Gets the uploaded files from a file upload component.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a file upload.

Collection<string, APIAttachment>

The uploaded files, or null if not set and not required.


getRadioGroupValue(custom_id, required?): string | null

Defined in: resolvers/ModalComponentResolver.ts:312

Gets the selected value of a radio group component.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a radio group.

string | null

The selected value, or null if not set and not required.

getRadioGroupValue(custom_id, required): string

Defined in: resolvers/ModalComponentResolver.ts:313

Gets the selected value of a radio group component.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a radio group.

string

The selected value, or null if not set and not required.


getSelectedChannels(custom_id, required?): Collection<string, APIInteractionDataResolvedChannel> | null

Defined in: resolvers/ModalComponentResolver.ts:169

Gets the selected channels from a channel select menu.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a channel select.

Collection<string, APIInteractionDataResolvedChannel> | null

The selected channels, or null if not set and not required.

getSelectedChannels(custom_id, required): Collection<string, APIInteractionDataResolvedChannel>

Defined in: resolvers/ModalComponentResolver.ts:170

Gets the selected channels from a channel select menu.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a channel select.

Collection<string, APIInteractionDataResolvedChannel>

The selected channels, or null if not set and not required.


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).

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a user select.

Collection<string, ResolvedSelectedGuildMember> | null

The selected members, or null if not set and not required.

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).

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a user select.

Collection<string, ResolvedSelectedGuildMember>

The selected members, or null if not set and not required.


getSelectedMentionables(custom_id, required?): (APIRole | APIUser | ResolvedSelectedGuildMember)[] | null

Defined in: resolvers/ModalComponentResolver.ts:256

Gets the selected mentionables from a mentionable select menu.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a mentionable select.

(APIRole | APIUser | ResolvedSelectedGuildMember)[] | null

The selected mentionables (users, members, or roles), or null if not set and not required.

getSelectedMentionables(custom_id, required): (APIRole | APIUser | ResolvedSelectedGuildMember)[]

Defined in: resolvers/ModalComponentResolver.ts:257

Gets the selected mentionables from a mentionable select menu.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a mentionable select.

(APIRole | APIUser | ResolvedSelectedGuildMember)[]

The selected mentionables (users, members, or roles), or null if not set and not required.


getSelectedRoles(custom_id, required?): Collection<string, APIRole> | null

Defined in: resolvers/ModalComponentResolver.ts:237

Gets the selected roles from a role select menu.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a role select.

Collection<string, APIRole> | null

The selected roles, or null if not set and not required.

getSelectedRoles(custom_id, required): Collection<string, APIRole>

Defined in: resolvers/ModalComponentResolver.ts:238

Gets the selected roles from a role select menu.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a role select.

Collection<string, APIRole>

The selected roles, or null if not set and not required.


getSelectedUsers(custom_id, required?): Collection<string, APIUser> | null

Defined in: resolvers/ModalComponentResolver.ts:195

Gets the selected users from a user select menu.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a user select.

Collection<string, APIUser> | null

The selected users, or null if not set and not required.

getSelectedUsers(custom_id, required): Collection<string, APIUser>

Defined in: resolvers/ModalComponentResolver.ts:196

Gets the selected users from a user select menu.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a user select.

Collection<string, APIUser>

The selected users, or null if not set and not required.


getSelectedValues(custom_id, required?): readonly string[] | null

Defined in: resolvers/ModalComponentResolver.ts:152

Gets the selected values of a select menu component.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a select menu.

readonly string[] | null

The selected values, or null if not set and not required.

getSelectedValues(custom_id, required): readonly string[]

Defined in: resolvers/ModalComponentResolver.ts:153

Gets the selected values of a select menu component.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a select menu.

readonly string[]

The selected values, or null if not set and not required.


getString(custom_id, required?): string | null

Defined in: resolvers/ModalComponentResolver.ts:135

Gets the value of a text input component.

string

The custom ID of the component.

boolean

Whether to throw an error if the component is not found or not a text input.

string | null

The value of the text input, or null if not set and not required.

getString(custom_id, required): string

Defined in: resolvers/ModalComponentResolver.ts:136

Gets the value of a text input component.

string

The custom ID of the component.

true

Whether to throw an error if the component is not found or not a text input.

string

The value of the text input, or null if not set and not required.