So I created this command that utilizes Embeds, it used columns where I could input strings. It achived this by having the value as an array. But in V13 this doesn't seem to work, it keeps coming up with the same error:
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings
How the embed looked like V12:
V12 code:
const embed = new Discord.MessageEmbed()
.setTitle("Embed Title")
.setColor("DC143C")
.addFields(
{ name: "\u200B", value: "\u200B" },
{ name: "Field 1:", value: `Value`, inline: true },
{ name: "Field 2:", value: `Value`, inline: true },
{ name: "Field 3:", value: `Value`, inline: true },
{ name: "\u200B", value: "\u200B" },
{
name: `Column 1`,
value: ["word", "word", "word", "word", "word"],
inline: true,
},
{
name: `Column 2`,
value: ["word", "word", "word", "word", "word"],
inline: true,
},
{
name: `Column 3`,
value: ["word", "word", "word", "word", "word"],
inline: true,
}
);
How can I achive the same thing in Discord.JS v13?
CodePudding user response:
Try:
const embed = new Discord.MessageEmbed()
.setTitle("Embed Title")
.setColor("DC143C")
.addFields(
{ name: "\u200B", value: "\u200B" },
{ name: "Field 1:", value: `Value`, inline: true },
{ name: "Field 2:", value: `Value`, inline: true },
{ name: "Field 3:", value: `Value`, inline: true },
{ name: "\u200B", value: "\u200B" },
{
name: `Column 1`,
value: ["word", "word", "word", "word", "word"].join('\n'),
inline: true,
},
{
name: `Column 2`,
value: ["word", "word", "word", "word", "word"].join('\n'),
inline: true,
},
{
name: `Column 3`,
value: ["word", "word", "word", "word", "word"].join('\n'),
inline: true,
}
);
Now only strings can be field values, see https://discordjs.guide/additional-info/changes-in-v13.html#strings