Class StringSelectMenuBuilder

Hierarchy

  • StringSelectMenuBuilder
    • StringSelectMenuBuilder

Constructors

Properties

The API data associated with this component.

options: StringSelectMenuOptionBuilder[]

The options within this select menu.

Methods

  • Sets the custom id for this select menu.

    Parameters

    • customId: string

      The custom id to use

    Returns StringSelectMenuBuilder

  • Sets whether this select menu is disabled.

    Parameters

    • Optional disabled: boolean

      Whether this select menu is disabled

    Returns StringSelectMenuBuilder

  • Sets the maximum values that must be selected in the select menu.

    Parameters

    • maxValues: number

      The maximum values that must be selected

    Returns StringSelectMenuBuilder

  • Sets the minimum values that must be selected in the select menu.

    Parameters

    • minValues: number

      The minimum values that must be selected

    Returns StringSelectMenuBuilder

  • Sets the placeholder for this select menu.

    Parameters

    • placeholder: string

      The placeholder to use

    Returns StringSelectMenuBuilder

  • Removes, replaces, or inserts options for this select menu.

    Parameters

    • index: number

      The index to start at

    • deleteCount: number

      The number of options to remove

    • Rest ...options: RestOrArray<APISelectMenuOption | StringSelectMenuOptionBuilder>

      The replacing option objects or builders

    Returns StringSelectMenuBuilder

    Remarks

    This method behaves similarly to Array.prototype.splice(). It's useful for modifying and adjusting the order of existing options.

    Example

    Remove the first option:

    selectMenu.spliceOptions(0, 1);
    

    Example

    Remove the first n option:

    const n = 4;
    selectMenu.spliceOptions(0, n);

    Example

    Remove the last option:

    selectMenu.spliceOptions(-1, 1);
    
  • Serializes this builder to API-compatible JSON data.

    Returns APIStringSelectComponent

    Remarks

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

Generated using TypeDoc