dsc-utils
  • dsc-utils | Documentation
  • Getting Started
    • Setting up the project
    • Slash command executed
    • Button clicked
    • Dropdown field selected
  • Classes
    • Command
    • CommandOption
    • CommandChoice
    • Dropdown
    • DropdownOption
    • Button
  • Events
    • commandExecuted
    • buttonClicked
    • dropdownSelected
Powered by GitBook
On this page
  1. Events

buttonClicked

Run your code ehwn somebody clicks on a button

PreviouscommandExecutedNextdropdownSelected

Last updated 4 years ago

Was this helpful?

CtrlK

Was this helpful?

client.on("commandExecuted", cmd => {
    console.log(cmd)

    // Source...
})

id

The id of the button

guild

The guild object where the button got pressed

channel

The channel object where the button got pressed

member

The object of the guild member who pressed the button

interaction

The whole interaction that Discord provides

think()

Let the bot thinking

reply()

Reply to the interaction with a string, MessageEmbed or components

// Send a text
cmd.reply("Hello world!")

// Send an embed
cmd.reply(myEmbed)

// Send a text and an embed
cmd.reply({
    content: "Hello world!",
    embeds: [myEmbed] // embed: myEmbed
})

// Send a text, and embed and components
cmd.reply({
    content: "Hello world!",
    embed: myEmbed,
    components: [...]
})

Please note, that you can send just one Dropdown for one message

callback.edit()

Edit your responded message ( see reply() )

callback.delete()

Delete the responded message ( reply() / callback.edit() )

Return

The error message from Discord

{message: "Ok"}