Search code examples
javascriptdiscorddiscord.jsdiscord-buttons

Discord-buttons Action Row dont show up


I'm making a discord bot with discord.js. I want to add buttons to embed messages send by bot. but my buttons don't show up and i don't see any errors in the console.

Here's my code:

    const { MessageButton, MessageActionRow } = require("discord-buttons");

module.exports = {
    name: "yardım",
    description: "Yardım Al",
    async execute(client, message, args, Discord) {

        const embed = new Discord.MessageEmbed()
            .setAuthor(message.guild.me.user.username, message.guild.me.user.displayAvatarURL())
            .setColor(message.guild.me.displayHexColor)
            .setDescription("{Turtle}'ı nasıl kullanacağını bilmiyor musun? Çok Yazık! Neyse bu dert değil. \n\n 'Bilmemek değil, öğrenmemek ayıp!' derler. Hadi Öğrenelim! \n \u200B")
            .addFields(
                { name: 'Komutlar', value: 'Bütün komutlara [buradan](https://www.youtube.com/watch?v=dQw4w9WgXcQ) ulaşabilirsin. \n\u200B' },
                { name: 'Yardım', value: 'Merak ettiklerinizi ve anlamadığımız şeyleri [buradan](https://www.youtube.com/watch?v=dQw4w9WgXcQ) botun geliştiricisine sorabilirsin. \n\u200B' },
                { name: 'Destek Olun', value: 'Bu projeyi daha da ileri götürmek için sizin desteğinize ihtiyacım var. [Buradan](https://www.youtube.com/watch?v=dQw4w9WgXcQ) nasıl destek olabileceğinize bakabilirsiniz.' },
            )

        const embedLinks = new MessageActionRow().addComponents(
            new MessageButton()
                .setStyle("url")
                .setURL('https://www.youtube.com/watch?v=nYh-n7EOtMA') 
                .setLabel('URL 2')
                .setID("url2"),
            new MessageButton()
                .setStyle('url')
                .setURL('https://www.youtube.com/watch?v=nYh-n7EOtMA') 
                .setLabel('URL')
                .setID("url2")
        )

        console.log(embedLinks);

        message.channel.send({
            embed: embed,
            component: embedLinks
        });
    }
}

Output on discord channel:

enter image description here


Solution

  • Solution was easy.

    go to your master file like 'main.js' or 'index.js'.

    put this require('discord-buttons')(client); after importing discord js