showing results for - "discord js button"
Mika
18 Jan 2019
1const discord = require('discord.js'); //Define the discord.js module
2const client = new discord.Client(); //Creating discord.js client (constructor)
3require('discord-buttons')(client);
4const { MessageButton, MessageActionRow } = require('discord-buttons')
5
6
7client.on('message', async message => {
8  if(message.content === "test"){
9  const button = new MessageButton()
10  .setLabel("test")
11  .setStyle("green")
12  .setID("btn1")
13
14  message.channel.send("test components", button)
15  }
16})
17
18client.on('clickButton', async (button) => {
19  if(button.id === "btn1"){
20    await button.reply.defer()
21    await button.message.channel.send("button green")
22  }
23})
24
25
26client.login('Your Token')
27
Manuel
21 Jun 2018
1//Note that you need the Node module installed!
2let button = new disbut.MessageButton()
3  .setStyle('red') //default: blurple
4  .setLabel('My First Button!') //default: NO_LABEL_PROVIDED
5  .setID('click_to_function') //note: if you use the style "url" you must provide url using .setURL('https://example.com')
6  .setDisabled(); //disables the button | default: false
7
8message.channel.send('Hey, i am powered by https://npmjs.com/discord-buttons', button);
Phoenix
19 Jan 2020
1/*Sending multiple embeds and buttons
2Assuming you have them created.
3*/
4
5message.channel.send('Optional Normal Text', {
6	buttons: [button1, button2],
7  	embeds: [embed1, embed2]
8})
9
10// You can do the same for sending only 1 button or embed
11
12message.channel.send('option blahblah', {
13	button: button1,
14  	embed: embed1
15})
16
17//Just some alternative ways to do this :)
Lya
29 Aug 2018
1client.on('message', message => {
2if(message.content.startsWith(prefix + "ticket-message")) {
3    let btn1 = new disbut.MessageButton()
4    .setStyle('red')
5    .setEmoji(":ticket:")
6    .setID('1')
7    message.delete()
8    message.channel.send(`react here to open a ticket`, btn1)
9    }
10})
11client.on('clickButton', async (button) => {
12    await button.defer();
13    if(button.id === "1") {
14    let btn2 = new disbut.MessageButton()
15    .setLabel('close')
16    .setStyle('red')
17    .setEmoji(":x:")
18    .setID('2')
19  button.guild.channels.create(`${button.clicker.user.username} ticket`, {
20    permissionOverwrites: [
21        {
22            id: button.guild.roles.everyone,
23            deny: ['VIEW_CHANNEL'],
24        },
25        {
26            id: button.clicker.user.id,
27            allow: ['VIEW_CHANNEL'],
28        },
29    ],
30}).then(channel => {
31      channel.send(`**please wait for our support team \n react with the emoji to close the ticket**`, btn2)
32
33  })
34
35    }
36        if(button.id === "2") {
37    
38     button.channel.send("deleting after 5 seconds")
39     setTimeout(function() {
40     button.channel.delete();
41    }, 5000)
42    }
43})
Santiago
14 Oct 2018
1npm i discord-buttons
queries leading to this page
discord buttons installwhat happened to https 3a 2f 2fdiscord buttons js org 2fworking discord js buttonhow to create button discordjsbuttons discord botsdiscord js bot buttonshow to create buttons in discord jsdiscord js buttondiscord buttons examplebutton in description discord jsdiscord js button client ondiscord bot buttons examplenew button in discord jsdiscordrpc buttondiscord js button pagebutton pages discord jsbuttons on discord jsdiscord js button gamebutton methods in discord jsbutton help code discord jsdiscordjs buttonhow to do buttons in discord jsdiscord buttons docscreating a discord button with discord jsdiscord js buttodiscord buttons examplediscord guide buttonsdiscord buttons discord js fucntionhow to button in discordbuttons in bot discord 7c code 27https 3a 2f 2fdiscord buttons js org 2f 27discord bvuttonsbutton doc discord jscreate button discord jsdiscord js discord buttonsdiscord js how to use buttonsdiscord js button guidecreate buttons discord jscreate button discord jsdiscord js button pagesdiscord js buttonmsdiscord button helpdiscord button function jsdiscord button jsdiscord js butt buttons in discord js v12discord js org button examplediscord buttons example nodejsdiscord js discord button issuesdiscord js buttons documentdiscord buttondhow to use buttons with discord jsdiscord js button docdiscord buttons nodejs 27https 3a 2f 2fdiscord buttons js org 2fcreate a button discord jsdiscord js button commandsbuttons discord jshow to use buttons in discord jsbot with buttons discord jsdiscord new buttonsdiscord button 2csdiscord buttons disdiscord js buttons examplecreate a button on discord in node jsuse buttons discord jsdiscord buttons in help js 5cnew button discord jsdiscord 2cjs button botdiscord buttons discord jsdiscord js buttosbuttons bot discord codediscord js buttondiscord button js orgbuttons tutorial discord jsbutton discord jsdiscord bot buttons jsbutton functions discord jshow to make discord buttonsdiscord js make buttonnew buttons on discorddiscord js buttonswhat discord js version does discord buttons usehow to code button in discord jsbuttons discord botnodejs discord buttonsdiscord js create buttondiscord buttons example discord 2c jsbuttonss discord jsbutton discord jsdiscord js button on buttons discord jsbuttons discorddiscord buttons botdiscord j buttonsdiscord button examplediscord js bot buttonsnew discord buttonsbutton discord jshow to create a button in discord jsdiscord button discord jsdiscord buttons jshow to get buttons in discord jsdiscord js buttonshow to use discord buttons node jsdiscord butttonsbutton differ discord jsdiscord js new buttonsdiscord buttons elementsnew discord button discord jsdiscord buttons example discord jshow to use a discord js buttonbuttons discord js examplehow to make a discordjs buttondiscord js button helpdiscord js btdiscord buttons discord jsdiscord buttons jsbutton in discord jsdiscord butttondhow to make button discord js button discord jsbuttons discord code jsbutton discorddiscord js button supportdiscord js simple button button discord js v12how to make buttons in discord jsdiscord js button examplediscord buttondiscord buttonsdiscord js use buttonsdiscord how to make buttonsdiscord how to make a buttondiscord buttons jsdiscord create buttonsusing buttons with discord jshow to create button discord jsbuttons in discord jsbuttons in discordhow to make buttons do stuff discord jsdiscord js buttons guidediscord things to do with buttonsbutton js discorddiscord js buttons functiondiscord buttons discord jsdiscord js button disaled button discord jsdiscord js buttons propertiesmake a button discorddiscord buttons nmsdiscord js buttonsdiscord button bothttps 3a 2f 2fdiscord buttons js org 2fdiscord js buttons docmake a button on discordhow to make buttons discord jshow to make a button discord jsbuttons for discord bothow to make a button in discord jsbutton discordjsbuttons btw discorddiscord components buttonshow to make button in discord jsdiscord buttons discord js example use interactive discord buttons discord js how to have discord buttonsdiscord js buttonshow to make buttons in discord jsdiscord bot buttonsdiscord buttons 21buttonclick discord jsdiscord js button