aoajqoshd
aoajqoshd

Reputation: 21

(Discord.js) Using the discord-buttons npm package, how can I disable a button?

Using discord-buttons (https://www.npmjs.com/package/discord-buttons), how can I “Disable” a discord button? (Grey it out so only specific users can click on it)

Upvotes: 0

Views: 1880

Answers (1)

Christoph Blüm
Christoph Blüm

Reputation: 975

You can disable a button by typing:

button.setDisabled();

If you want to set multiple attributes for that button, you can do this the following way:

let button = new disbut.MessageButton()
  .setStyle('red')
  .setLabel('My First Button!') 
  .setID('click_to_function') 
  .setDisabled();

message.channel.send('Hey, i am powered by https://npmjs.com/discord-buttons', button);

Source: https://discord-buttons.js.org/examples

Upvotes: 1

Related Questions