Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

555
Views
Discord.js DiscordAPIError: Invalid Form Body issue

I have a Discord bot and there is a problem with the command named privacy policy in this bot, I asked a lot of people and they said they don't know.

Node.js version: 16.13.2 Discord.js version: 13.6.0

MAİN

client.commands = new Collection();

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
}

COMMAND

module.exports = {
    name: 'gizlilik',
    description: 'gizlilik politikası',
    execute(message, args) {
    const Discord = require("discord.js")
    const gizlilik = new Discord.MessageEmbed()
    .setTitle("Hextro Gizlilik Politikası")
    .setDescription("Gizlilik Politikasına aşağıdaki butondan ulaşabilirsiniz.")
    .setColor("RANDOM")

    const buton = new Discord.MessageButton()
    .setLabel("Politika")
    .setStyle("url")
    .setURL("https://github.com/Husum0/Hextro-Gizlilik-Politikasi/blob/main/gizlilik.md");
    let row = new Discord.MessageActionRow()
    .addComponents(buton)
  
  message.channel.send({ content: 'Pong!', embeds: [gizlilik], components: [row] });
    },
};

ERROR

Unhandled promise rejection: DiscordAPIError: Invalid Form Body components[0].components[0].style: This field is required at RequestHandler.execute (C:\Users\Administrator\Desktop\hexiye\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RequestHandler.push (C:\Users\Administrator\Desktop\hexiye\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async TextChannel.send (C:\Users\Administrator\Desktop\hexiye\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15) { method: 'post', path: '/channels/931267478292680769/messages', code: 50035, httpStatus: 400, requestData: { json: { content: 'Pong!', tts: false, nonce: undefined, embeds: [Array], components: [Array], username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: undefined, message_reference: undefined, attachments: undefined, sticker_ids: undefined }, files: [] } }

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

url is not a valid style to set your embed to, instead, it should be LINK - see discord.js documentation here.

your command should end up looking like this:

module.exports = {
    name: 'gizlilik',
    description: 'gizlilik politikası',
    execute(message, args) {
        const Discord = require('discord.js');
        const gizlilik = new Discord.MessageEmbed()
            .setTitle('Hextro Gizlilik Politikası')
            .setDescription('Gizlilik Politikasına aşağıdaki butondan ulaşabilirsiniz.')
            .setColor('RANDOM');

        const buton = new Discord.MessageButton()
            .setLabel('Politika')
            .setStyle('LINK')
            .setURL('https://github.com/Husum0/Hextro-Gizlilik-Politikasi/blob/main/gizlilik.md');
        let row = new Discord.MessageActionRow().addComponents(buton);

        message.channel.send({ content: 'Pong!', embeds: [gizlilik], components: [row] });
    }
};
about 4 years ago · Juan Pablo Isaza Report

0

For when it says you have invalid for of body ,,, all that means is to update your app Go to you appstore look for discord and update the app!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!