I'm trying to make a command that sends an embed. But for some reason, it keeps saying DiscordAPIError: Invalid Form Body data.embeds[0].description: This field is required Error even tho the description isn't whitespace.
I'm hosting it in heroku so the error is from the logs.
Command Script:
module.exports = {
name: "test",
desc: "A test command",
cmd: async (interaction, utils) => {
await interaction.user.fetch()
.then(async ({ hexAccentColor }) => {
interaction.reply({ embeds: [
utils.embed(
"Hello!",
interaction.member.displayAvatarURL(),
`Your name is <@${interaction.member.id}> and you're now in the special list! (jk)`,
"",
hexAccentColor
)
] })
})
}
}
Utils:
embed: async (title, thumbnail, desc, footer, color) => {
const { MessageEmbed } = require("discord.js")
await client.user.fetch()
.then(({ hexAccentColor }) => {
const embed = new MessageEmbed()
.setAuthor("GND Bot", client.user.avatarURL())
.setTitle(title)
.setColor(color || hexAccentColor)
.setDescription(desc)
.setThumbnail(thumbnail || client.user.avatarURL())
.setFooter(footer)
return embed
})
}
Error:
2021-11-08T10:20:12.649708+00:00 app[worker.1]: /app/node_modules/discord.js/src/rest/RequestHandler.js:349
2021-11-08T10:20:12.649731+00:00 app[worker.1]: throw new DiscordAPIError(data, res.status, request);
2021-11-08T10:20:12.649732+00:00 app[worker.1]: ^
2021-11-08T10:20:12.649732+00:00 app[worker.1]:
2021-11-08T10:20:12.649732+00:00 app[worker.1]: DiscordAPIError: Invalid Form Body
2021-11-08T10:20:12.649733+00:00 app[worker.1]: data.embeds[0].description: This field is required
2021-11-08T10:20:12.649733+00:00 app[worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:349:13)
2021-11-08T10:20:12.649734+00:00 app[worker.1]: at processTicksAndRejections (node:internal/process/task_queues:96:5)
2021-11-08T10:20:12.649734+00:00 app[worker.1]: at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
2021-11-08T10:20:12.649735+00:00 app[worker.1]: at async CommandInteraction.reply (/app/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:98:5) {
2021-11-08T10:20:12.649735+00:00 app[worker.1]: method: 'post'