buttons discord js code example

Example 1: discord.js button

//Note that you need the Node module installed!
let button = new disbut.MessageButton()
  .setStyle('red') //default: blurple
  .setLabel('My First Button!') //default: NO_LABEL_PROVIDED
  .setID('click_to_function') //note: if you use the style "url" you must provide url using .setURL('https://example.com')
  .setDisabled(); //disables the button | default: false

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

Example 2: discord.js buttons

/*Sending multiple embeds and buttons
Assuming you have them created.
*/

message.channel.send('Optional Normal Text', {
	buttons: [button1, button2],
  	embeds: [embed1, embed2]
})

// You can do the same for sending only 1 button or embed

message.channel.send('option blahblah', {
	button: button1,
  	embed: embed1
})

//Just some alternative ways to do this :)