Button
Create a Button
CLI Pattern
bot add buttonExample
Define Button Parameters
import { Button } from "#core/button"
export type BuyButtonParams = {
article: string
quantity: number
}
export default new Button<BuyButtonParams>({
key: "buy",
description: "The buy button",
builder: (builder) => builder.setLabel("Buy"),
async run(interaction, article, quantity) {
await interaction.deferUpdate()
await interaction.followUp({
content: `You clicked the buy button for ${quantity}x ${article}!`,
ephemeral: true,
})
},
})Using the Button
Last updated