0
votes

Bot was working fine, i was updating every now and then to make some new changes, i Redo'd everything i did back when it was working perfectly yet it kept crashing.

Code:

module.exports = {
name: 'vouch',
description: "this is a vouch command!",
execute(message, args, Discord) {
    const client = message.client;
    const newEmbed = new Discord.MessageEmbed()


    message.channel.send(newEmbed);

    if (message.member.roles.cache.has('768903864782553108')) {
        const targetID = message.mentions.users.first();

        return message.channel.send(new Discord.MessageEmbed()
        
            //.setTitle
            .setDescription(`????You have vouched for **${targetID}**.`)
            .setColor('GREEN')
            .setFooter(client.user.username, client.user.displayAvatarURL())
            .setAuthor(message.author.tag, message.author.displayAvatarURL())
            .setTimestamp()
            .setFooter('Bot was programmed by ~', 'https://i.gyazo.com/04b40914f14d5dba8aebb532ed3e80f3.png')
        )
    }
}

}

The error:

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

DiscordAPIError: Invalid Form Body embed.description: This field is required at RequestHandler.execute (C:\Users~\Desktop\Discordbot\node_modules\discord.js\src\rest\RequestHandler.js:154:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RequestHandler.push (C:\Users~\Desktop\Discordbot\node_modules\discord.js\src\rest\RequestHandler.js:39:14) { method: 'post', path: '/channels/683675132677718107/messages', code: 50035, httpStatus: 400 }

1
It shows there some error in your Embed Code. - Bhavyadeep Yadav

1 Answers

0
votes

you can just simply do this:

module.exports = {
name: 'vouch',
description: "this is a vouch command!",
execute(message, args, Discord) {

if (message.member.roles.cache.has('768903864782553108')) {

        const targetID = message.mentions.users.first();
        const newEmbed = new Discord.MessageEmbed()
                    //.setTitle
                    .setDescription(`👍You have vouched for **${targetID}**.`)
                    .setColor('GREEN')
                    .setFooter(client.user.username, client.user.displayAvatarURL())
                    .setAuthor(message.author.tag, message.author.displayAvatarURL())
                    .setTimestamp()
                    .setFooter('Bot was programmed by ~', 'https://i.gyazo.com/04b40914f14d5dba8aebb532ed3e80f3.png')

         message.channel.send(newEmbed)
          
    }
  }
}

EDIT: and as a side note the error originated where you called a new embed but didn't give any values for it.

const newEmbed = new Discord.MessageEmbed()


message.channel.send(newEmbed);