I need little help. I want to set my buttons to be functional. I'm using this package discord-buttons
So, i created two buttons: for cleaning channel and locking channel.
I don't know how to set them to work.
There is code.
let opcijaKanala = new MessageButton()
.setStyle("green")
.setLabel("Otkljucaj kanal")
.setID("unlockChannel")
Maybe I need something like this?
client.on('buttonClicked' //... )
The event for button clicks is interactionCreate
Something a little like this may work
client.on("interactionCreate", (ctx) => {
if(!ctx.isButton()) return // filter out commands and non-buttons
if(ctx.customId === "foobar") {
// do something amazing
}
})