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!"); }} Copy
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!"); }}
Static
Returns ButtonBuilder that was created from the button options.
Returns a new ButtonBuilder with the specified options merged with the default options defined in the class.
The options to merge with the default options.
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.
Example