oopscord.js
    Preparing search index...

    Class BaseButton

    The base class for buttons created with the Button decorator. This class is used to create a button from the options defined in the class, and to override the default options with new options when creating the button.

    import { ButtonInteraction, ButtonStyle } from "discord.js";
    import { Button, BaseButton, Interaction, Run } from "oopscord.js";

    Button({
    customId: "my_button",
    label: "Click me!",
    style: ButtonStyle.Primary
    })
    class MyButton extends BaseButton {
    constructor(@Interaction readonly interaction: ButtonInteraction) {
    super();
    }

    Run
    async run() {
    await this.interaction.reply("You clicked the button!");
    }
    }
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Returns a new ButtonBuilder with the specified options merged with the default options defined in the class.

      Type Parameters

      Parameters

      • options: Partial<T>

        The options to merge with the default options.

      Returns ButtonBuilder