Discord.https - v3.0.16
    Preparing search index...

    Class LabelBuilder

    A builder that creates API-compatible JSON data for labels.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new label.

      Parameters

      Returns LabelBuilder

      Creating a label from an API data object:

      const label = new LabelBuilder({
      label: "label",
      component,
      });

      Creating a label using setters and API data:

      const label = new LabelBuilder({
      label: 'label',
      component,
      }).setLabel('new text');

    Methods

    • Clears the description for this label.

      Returns this

    • Clears the id of this component, defaulting to a default incremented id.

      Returns this

    • Sets the description for this label.

      Parameters

      • description: string

        The description to use

      Returns this

    • Sets the id (not the custom id) for this component.

      Parameters

      • id: number

        The id for this component

      Returns this

    • Sets the label for this label.

      Parameters

      • label: string

        The label to use

      Returns this

    • Serializes this builder to API-compatible JSON data.

      Returns APILabelComponent

      This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.