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 :: bootstrap modal clear all fields 
Javascript :: install node on ubuntu and debian 
Javascript :: javascript to remove duplicates from an array 
Javascript :: js string does not contain 
Javascript :: tailwind config 
Javascript :: getting current date and time in javascript 
Javascript :: post data from api using jquery ajax 
Javascript :: javascript string methods 
Javascript :: chrome add a bookmark that appends to current url 
Javascript :: moment cdn 
Javascript :: regex char and number 
Javascript :: regex for exactly n digits 
Javascript :: javascript string startswith 
Javascript :: how to add oAuth google signin in react native app 
Javascript :: create an array of numbers 
Javascript :: javascript regex replace 
Javascript :: electron jquery 
Javascript :: jquery check if exist 
Javascript :: javascript class inheritance 
Javascript :: react native android padding style 
Javascript :: join array of object name javascript 
Javascript :: redirect if not logged in next js 
Javascript :: js array two dimensional 
Javascript :: how to use Space for vertically in antd 
Javascript :: how to get url in react 
Javascript :: update chart js with new data 
Javascript :: nodejs await inside map 
Javascript :: generate random id 
Javascript :: access selected option in jquery 
Javascript :: json-server npm 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =