discord-easy-interactions
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Discord Easy Interactions (1.0.4)

💥 Easy to use discord interactions with callback system. onClick, onSelect etc.

Install

npm install discord-easy-interactions
// OR
yarn add discord-easy-interactions

Examples

First things first you need to add listeners for the events so you do like this.

const EasyInteractions = require("discord-easy-interactions");
// Client is your discord.js client.
EasyInteractions.registerClient(client);

Button Example

const EasyInteractions = require("discord-easy-interactions");

let inter = new EasyInteractions.EasyMessageButton({
      style: 1, // 
      emoji: {
        name: "❤"
      }, // Optional
      label: `1+1`, // Required
      onClick(data, b) {
        console.log(data)
      }
    });
    const row = new Discord.MessageActionRow().addComponents(inter)
    msg.channel.send({ content: 'Pong!', components: [row] });

DropDown Example

const EasyInteractions = require("discord-easy-interactions");
    let inter = new EasyInteractions.EasyMessageDropDown({
      onUpdate(data) {
        //console.log(data.deferReply())
        data.deferReply(true);
       // data.values[0] 
      },
      options: [
        {
          label: "Wow",
          emoji: null,
          onSelect(data, dd) {
            console.log("1")
            data.editReply("😍");
          }
        },
        {
          label: "Cringe",
          emoji: {
            name: "😂"
          },
          onSelect(data, dd) {
            console.log("1");
            data.editReply("😂");
          }
        },
        {
          label: "Dispose",
          emoji: null,
          onSelect(data, dd) {
            //data.editReply("💥 disposed", null);
            dd.dispose();
          }
        }
      ]
    });
    const row = new Discord.MessageActionRow().addComponents(inter)
    msg.channel.send({ content: 'Pong!', components: [row] });

Package Sidebar

Install

npm i discord-easy-interactions

Weekly Downloads

0

Version

1.0.4

License

GPLv3-or-later

Unpacked Size

53.3 kB

Total Files

18

Last publish

Collaborators

  • armagan_