Skip to content
Classhttpv0.10.2

ModalFields

The fields a modal carries, read by custom id.

Every getter throws when no field in the modal has that custom id. It also throws when the field holds a kind that getter does not read. The message names the getter that does.

A select getter resolves the ids its field picked against the interaction's resolved data and returns a Collection keyed by id. A field that picked nothing returns null. Pass required to throw there instead.

class ModalFields

Member visibility

Filter class members by access level.

constructor

Constructs a new instance of the ModalFields class

ModalFields(data: APIModalSubmission)

getCheckboxGroup()

public getCheckboxGroup(customId: string): string[]

getField()

Returns the field with this custom id, as Discord sent it. Use it for a component type the typed getters do not cover.

Pass a component type to get that exact type back. It throws when the field holds a different one.

public getField<Kind>(
    customId: string,
    kind: Kind
): Extract<ModalSubmitComponent, { type: Kind }>

getStringSelectValues()

public getStringSelectValues(
    customId: string
): string[]

getTextInputValue()

public getTextInputValue(customId: string): string