discord-buttons-react

0.0.4 • Public • Published

discord-buttons-react Gif example


discord-buttons-react is a package that allow you to use buttons as reactions.

BETA ! there's probably some bugs !


Install

npm install discord-buttons-react

Setup

const discord = require('discord.js');
const client = new discord.Client();
require('discord-buttons')(client); // must be below your discord.Client()
require('discord-buttons-react')(client); // must be below your discord.Client()

You absolutly need to require both discord-buttons and discord-buttons-react !


Method

message.channel.createMessageReactionButton(content, ButtonsReactionArray);

Example

const disbutreact = require("discord-buttons-react");

const embed = new Discord.MessageEmbed().setColor("BLURPLE").setDescription("Click to add reaction !")

const ReactionButton1 = new disbutreact.ReactionButton()
    .setStyle('red')
    .setEmoji('✨');

const ReactionButton2 = new disbutreact.ReactionButton()
    .setStyle('green')
    .setEmoji('🎉');

message.channel.createMessageReactionButton("test", [ReactionButton1, ReactionButton2]);
// or
message.channel.createMessageReactionButton(embed, [ReactionButton1, ReactionButton2]);
  • You can put max 25 ReactionButtons.
  • If you don't precise any style, it will be "grey". You can't use url style.

New Events

messageButtonReactionAdd

client.on("messageButtonReactionAdd", reactionButton => {
    // your code
})

messageButtonReactionRemove

client.on("messageButtonReactionRemove", reactionButton => {
    // your code
})

Both events return reactionButton object :

methods result
clicker .user / .member
reactionEmoji emoji name or id
message message object

Contact

Discord

Package Sidebar

Install

npm i discord-buttons-react

Weekly Downloads

6

Version

0.0.4

License

Apache-2.0

Unpacked Size

25.6 kB

Total Files

4

Last publish

Collaborators

  • gaetan20