Discord.js: MessageEmbed > .flat is not a function.

Created on 16 Mar 2020  Â·  2Comments  Â·  Source: discordjs/discord.js

Please describe the problem you are having in as much detail as possible:
I'm trying to send an embed using the MessageEmbed constructor but I get an error: .flat is not a function for MessageEmbed. When I'm trying to send an embed with embed since v12 I get this error.
Include a reproducible code sample here, if possible:

const embed = new Discord.MessageEmbed()
            embed.setTitle("my text");
            embed.addFields( 
                {name: "my text", value: "`my text`"},
                {name: "my text", value: "my text"}
            );
            embed.setFooter("my text");
            embed.setColor("#892252");
            return message.channel.send(embed);
//I got the same error by using .addField("my text", "my text")...

Further details:

  • discord.js version: v12.0.2
  • Node.js version: Latest version (>12)
  • Operating system: Windows, Linux
  • Priority this issue should have – please be realistic and elaborate if possible: Many devs use MessageEmbed constructor and can be stuck.
  • [x] I have also tested the issue on latest master, commit hash:
duplicate invalid

Most helpful comment

Duplicate of #3913, #3910, #3888, #3887, and #3883.

All 2 comments

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.
You won't receive any basic help here.

That said, the readme for the library clearly states you need Node v12.x or higher to use the discord.js library. Please update your Node.

Duplicate of #3913, #3910, #3888, #3887, and #3883.

Was this page helpful?
0 / 5 - 0 ratings