M
M
MoneySMile2021-10-22 10:10:36
Node.js
MoneySMile, 2021-10-22 10:10:36

Why are discord.js buttons not working?

The button doesn't work and I don't understand why.

The code
const { MessageEmbed } = require('discord.js');
const discord = require('discord.js'); //Define the discord.js module
const client = new discord.Client(); //Creating discord.js client (constructor)
const disbut = require('discord-buttons');
disbut(client);

module.exports.properities = {
    name:["321"]
}

module.exports.run = async (bot,message,member,args) => {
    if(!message.author.id == (292353154111242241))return
      const btn1 = new disbut.MessageButton()
        .setStyle('red')
                .setID(`click`)
        .setLabel('asdasdasdasd') 
        // .setURL('https://npmjs.com/discord-buttons')
        .setDisabled(false); 
        message.channel.send(`RowsTest`, { component: btn1 });


                btn1.on('clickButton', async (button) => {
                if (button.id == "click_to_function") {
                    button.reply.send('On Red Button click', { ephemeral: true });
                }
        })      
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question