Buttons

All these functions can be used with messages as interactions.

Use these functions with message functions?

Change interaction to message. For example: interaction.send("Hello!"); then becomes message.send("Hello!");

Button

const embed = interaction.embedSuccess("This is a success embed!");

const button = interaction.button({
   label: "button",
   style: "PRIMARY", // PRIMARY or SECONDARY
   id: "button1"
})
const row = interaction.row(button);

interaction.channel.send({ embeds: [embed], components: [row] })

Success button

const embed = interaction.embedSuccess("This is a success embed!");
const button = interaction.buttonSuccess("Success", "Success");
const row = interaction.row(button);

interaction.channel.send({ embeds: [embed], components: [row] })

Danger button

const embed = interaction.embedSuccess("This is a success embed!");
const button = interaction.buttonDanger("Danger", "Danger");
const row = interaction.row(button);

interaction.channel.send({ embeds: [embed], components: [row] })
const embed = interaction.embedSuccess("This is a success embed!");
const button = interaction.buttonLink("Link", "URL");
const row = interaction.row(button);

interaction.channel.send({ embeds: [embed], components: [row] })

Button event

client.on('buttonClick', async (interaction) => {
    // Code here
})

Last updated