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

Why isn't embeds index not working when sending a message

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:

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

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)
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