Skip to content
Classhttpv0.11.0

ModalFields

The fields a modal carries, read by custom id.

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.

Throws:

  • A SeedcordTypeError from every getter when no field in the modal has that custom id.

  • A SeedcordTypeError from every getter when the field holds a kind that getter does not read. The message gives the getter that does.

  • A SeedcordTypeError from a select getter called with required when its field picked nothing.

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.

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

Throws:

A SeedcordTypeError when no field has this custom id.

Throws:

A SeedcordTypeError when you pass a component type and the field holds a different one.

getStringSelectValues()

public getStringSelectValues(
    customId: string
): string[]

getTextInputValue()

public getTextInputValue(customId: string): string