Discord Bot BaseResponders

Buttons

how to reply discord buttons

Reply to a button by setting the Responder type to button.

command.ts
import { createRow, createComponents } from "@magicyan/discord";

const row = createRow(
    new ButtonBuilder({
        customId: "/system/confirm", 
        label: "Confirm", 
        style: ButtonStyle.Success
    })
);
await interaction.reply({ 
    flags: ["Ephemeral", "IsComponentsV2"], 
    components: createComponents(row) 
});
responder.ts
createResponder({
    customId: "/system/confirm",
    types: [ResponderType.Button], cache: "cached",
    async run(interaction) {
        interaction.update({ 
            components: createComponents(
                "Confirmado"
            )
        });
    },
});