oopscord.js
    Preparing search index...

    Class BaseSelectMenu

    The base class for select menus created with the StringSelectMenu, UserSelectMenu, RoleSelectMenu, ChannelSelectMenu, and MentionableSelectMenu decorators. This class is used to create a select menu from the options defined in the class, and to override the default options with new options when creating the select menu.

    The select menu type is determined by the decorator used to create the select menu class, and can be one of the following:

    import { StringSelectMenuInteraction } from "discord.js";
    import { StringSelectMenu, BaseSelectMenu, Interaction, Run } from "oopscord.js";

    StringSelectMenu({
    customId: "my_select_menu",
    options: [
    { label: "Option 1", value: "option_1" },
    { label: "Option 2", value: "option_2" },
    { label: "Option 3", value: "option_3" }
    ]
    })
    class MySelectMenu extends BaseSelectMenu {
    constructor(@Interaction readonly interaction: StringSelectMenuInteraction) {
    super();
    }

    Run
    async run() {
    await this.interaction.reply(`You selected: ${this.interaction.values.join(", ")}`);
    }
    }
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Returns a new SelectMenuBuilder that was created from the select menu options.

      Returns
          | StringSelectMenuBuilder
          | UserSelectMenuBuilder
          | ChannelSelectMenuBuilder
          | RoleSelectMenuBuilder
          | MentionableSelectMenuBuilder

    • Returns a new SelectMenuBuilder with the specified options merged with the default options defined in the class, and the specified values merged with the default values defined in the class if the options include a options property (for StringSelectMenu) or defaultUsers/defaultRoles/defaultChannels property (for UserSelectMenu, RoleSelectMenu, ChannelSelectMenu, and MentionableSelectMenu).

      Type Parameters

      • K extends keyof SelectMenuMap

      Parameters

      • options: Partial<OptionsFromKind<K>> = {}

        The options to merge with the default options.

      • ...values: { description?: string; emoji?: string; label: string; value: string }[]

        The component values to merge with the default components. The customId property is used to match the values with the correct components, and the type property is used to determine which type of component the value is for.

      Returns BuilderFor<K>