Discord.js: All embeds giving an error

Created on 30 Jul 2020  路  7Comments  路  Source: discordjs/discord.js

Error:
bot-issue

Code:
await message.channel.send({embed: {description: "Hello",color: color.default}})

This error happens for every single message that my bot has to send. Some actually have fields with text and some doesn't

unverified bug

All 7 comments

I can't reproduce the error with the code you provided, can you provide code that the error can be consistently reproduced with?

Also, you deleted the issue template, which has important info that you need to provide.

Node Version: 14.6.0
Discord.js: 12.2.0
OS: Windows 10 Home 1903

The error mentions embed fields; the snippet provided only uses a description.

That's why I am here

Your stack trace quite clearly shows that you are in fact calling .addField() with an empty value in Index-Bot/logSync.js:265. Without any more information all I can deduce from the file names and stack trace this could be caused by a listener on message updates where you attempt to log the message.content.

Discord delivers embedded content by editing it in with an update action after the message is received, which does emit the "messageUpdate" client event. Now if your bot just sends an embed (no matter if the structure has fields or not, as demonstrated in your opening post) it tries to log the edit with an empty content which is rejected at

https://github.com/discordjs/discord.js/blob/fb1dd6b53aee68722b057f9a460eb618c61dd1c6/src/structures/MessageEmbed.js#L424-L425

If that is what's happening in Index-Bot/logSync.js:265 one solution is to compare the content of the old and the new message in the event callback (before you try to do anything with it) and returning if the content on both is the same. This will of course prevent any embed updates from showing up, but if this is the reason for the error your approach doesn't seem fit to deal with such updates anyways, so you might as well ignore all and any embed updates.


For future reference:
If you need help with discord.js installation or usage, please go to the discord.js Discord server instead:
https://discord.gg/bRCvFy9
This issue tracker is only for bug reports and enhancement suggestions.

OK, thanks for the help anyone was able to give me. I'll take a look.
And at this point is useless to go to the discord server cause no one usually helps (just as a note)

Seeing hundreds of questions being answered in discord on a daily basis I have to disagree with that statement (just as a note)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Brawaru picture Brawaru  路  3Comments

Blumlaut picture Blumlaut  路  3Comments

smchase picture smchase  路  3Comments

tiritto picture tiritto  路  3Comments

tom-barnes picture tom-barnes  路  3Comments