Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

discord.js Buttons to accept an request

const { MessageActionRow, MessageButtons } = require('discord.js')
const row = new MessageActionRow()
            .addComponents(
                new MessageButton()
                    .setCustomId('accept')
                    .setLabel('Aceitar')
                    .setStyle('SUCESS')
            )
            .addComponents(
                new MessageButton()
                    .setCustomId('deny')
                    .setLabel('Recusar')
                    .setStyle('DANGER')
            )
        interaction.reply({ content: `a`, components: [row] })

I wan’t to make the bot reply with two buttons to people accept and it’s getting this error

throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Invalid Form Body
data.components[0].components[0].style: This field is required

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The proper success style is SUCCESS, not SUCESS. Changing that should result in a valid message component:

const row = new MessageActionRow()
            .addComponents(
                new MessageButton()
                    .setCustomId('accept')
                    .setLabel('Aceitar')
                    .setStyle('SUCCESS')
            )
...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading