I’ve attempted for a while now to try and get msg.channel.send({ embeds: }) to work however I keep getting DiscordAPIError: Cannot send an empty message
I should note that all code is in a module however all the proper resources are required so I’m at a total loss here, we are also running Discord.JS v12.2.0.
Here is what we have:
const Discord = require("discord.js")
exports.run = async (client, msg, args) => {
let embed = new Discord.MessageEmbed()
.setTitle("Test")
.setColor("#00F0FF")
.setTimestamp();
client.log(JSON.stringify(embed.toJSON()), 1)
msg.channel.send({ embeds: }).then(() => {
}).catch(err => {
client.log(err, 2)
});
}
Just another note, even if I do provide the content index it posts the message just without the embed.
I can also do msg.channel.send(embed); and it posts the embed, however I am needing to post multiple embeds without spamming discords api.
>Solution :
You are using v12, but { embeds: [] } is only in v13. You should either update to v13 or use the old way
msg.channel.send(embed)