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

DiscordAPIError: Cannot send an empty message when sending MessageEmbed

I’m getting

DiscordAPIError: Cannot send an empty message at
RequestHandler.execute

├── discord.js@12.5.3
├── dotenv@10.0.0
├── mssql@7.3.0
└── nodemon@2.0.15

Basically it send message on server channel, but after sending message it throw the error

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 exampleEmbed = new MessageEmbed()
    .setColor('#0099ff')
    .setTitle(result1.recordset[0].Title)
    .setURL('https://www.ebay.com/itm/' + result1.recordset[0].ebay_id)
    .setAuthor(_state, _img, 'https://discord.js.org')
    .setDescription(output)
    .setThumbnail(result1.recordset[0].IMG)
    .addFields(
        { name: 'Price [Ebay]', value: result1.recordset[0].Price, inline: true },
        { name: 'Price [Poshmark]', value: result1.recordset[0].POSHMARK_PRICE, inline: true },
        { name: 'Price [Mercari]', value: result1.recordset[0].Mercari_price, inline: true }
    )
    .setTimestamp()
    .setFooter('Bot by programerAnel', 'https://i.imgur.com/wSTFkRM.png');

msg.reply(exampleEmbed)

All 100 lines of code on git: link

>Solution :

Looking at your entire code, it seems that line 40 was the real problem. Whenever you are sending something, never do a variable on its own. It could be nullish. Make sure to add a label so you don’t encounter this error, and it will be easy to debug

msg.reply("relatedLabel: " + result1.recordset[0].id)
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