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 :: exchange array.include(string) in Javascript to array.indexOf(string) == -1 in Typescript 
Javascript :: npm run after error 
Javascript :: ghjghj 
Javascript :: key being passed as prop react 
Javascript :: 7.3.2. Length or .length 
Javascript :: 8.1.4. Array Length or .length 
Javascript :: runincontext execute function 
Javascript :: scrolling a page using node and puppeteer 
Javascript :: isempty is not a function javascript 
Javascript :: delete all cookies javascript 
Javascript :: js object to jspn 
Javascript :: deneme 
Javascript :: create localStorage key + value if not exist 
Javascript :: mongoose remove more than 1 item 
Javascript :: javascript formdata include object 
Javascript :: use chai immutable 
Javascript :: Unexpected eval or arguments in strict mode 
Javascript :: create component with COUNT 
Javascript :: scroll to a input on button click react native 
Javascript :: find date range btween start date to end date in node js 
Javascript :: video playing 
Javascript :: js window selection get new line 
Javascript :: axios try catch get status code 
Javascript :: Comparison Primitive operations Methods 
Javascript :: how to detect two objects overlapping in javascript 
Javascript :: javascript state array and object cheat sheet 
Javascript :: react native biometrics sign in 
Javascript :: organize api calls react native folder 
Javascript :: bug in javascript 
Javascript :: javascript cast everything to string 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =