Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

discord.js buttons

/*
 			 Need more help? Add me on discord: Dwagon#0069
             				Discord.js ^13.8.1
*/

const { MessageButton, MessageActionRow } = require('discord.js');

const buttonVerify = new MessageActionRow()
        .addComponents(
          new MessageButton()
            .setCustomId('firstButton')
            .setLabel('First Button')
            .setStyle('PRIMARY')
          	.setDisabled(false), // Set it to "true" if you don't want people to be able to use the button at all
        )
        .addComponents(
          new MessageButton()
            .setCustomId('secondButton')
            .setLabel('Second Button')
            .setStyle('SECONDARY')
          	.setDisabled(false),
        )
		.addComponents(
          new MessageButton()
            .setCustomId('thirdButton')
            .setLabel('Third Button')
            .setStyle('SUCCESS')
          	.setDisabled(false),
        )
		.addComponents(
          new MessageButton()
            .setCustomId('fourthButton')
            .setLabel('Fourth Button')
            .setStyle('DANGER')
          	.setDisabled(false),
        )
		.addComponents(
          new MessageButton()
            .setLabel('Fifth Button')
          	.setURL("https://www.codegrepper.com/")
            .setStyle('LINK')
          	.setDisabled(false),
        );

/* 
		Button style
        PRIMARY 	- Blue
        SECONDARY 	- Gray
        SUCCESS		- Green
        DANGER  	- Red
        LINK		- Cannot put a customId to it		
        
*/
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #buttons
ADD COMMENT
Topic
Name
5+9 =