showing results for - "discord js components"
Arianna
29 Aug 2017
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')