Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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);
Comment

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		
        
*/
Comment

PREVIOUS NEXT
Code Example
Javascript :: html show password 
Javascript :: ?? in javascript 
Javascript :: export json / array to excel in javascript 
Javascript :: use of this keyword in js 
Javascript :: adb.exe: more than one device/emulator react native 
Javascript :: array sort numbers 
Javascript :: firebase get last document 
Javascript :: d3 v6 
Javascript :: best way to clone an object in javascript 
Javascript :: datatable add filter dropdown 
Javascript :: how to add an event listener to a function javascript 
Javascript :: javascript string spaces replace with %20 
Javascript :: linking open app settings 
Javascript :: moment duratuion from hours 
Javascript :: are you sure you want to close this window javascript 
Javascript :: download file in react 
Javascript :: render html in js.erb 
Javascript :: format phone number javascript 
Javascript :: split() javascript 
Javascript :: getelementbyclassname get multiple class 
Javascript :: Usage rate-limiter 
Javascript :: multi key cookie js 
Javascript :: iconify react 
Javascript :: nuxt custom plugin 
Javascript :: datatable on error.dt 
Javascript :: strupper in js 
Javascript :: merge two strings with alternate characters javascript 
Javascript :: how to disable security in jhipster 
Javascript :: angular turn text into input 
Javascript :: async function javascript dec 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =