Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Copy embed and modify between chats discordjs

I'm trying to change some information on embed messages then transfer the message from channels, but when I try to transfer the message, I have this error:

RangeError [EMBED_FIELD_NAME]: MessageEmbed field names must be non-empty strings.

I've trying like this:

let title;
let fieldName;
let fieldValue;

if(message.channel.id == analiseChannelID && reaction.emoji.name === 'aprovada') {
  message.embeds.forEach(embeds => {
    let title = embeds.title;
    //console.log(embeds.title); // logging to console ✅
    let fields = embeds.fields;
    fields.forEach((field) => {
      //console.log(field.name); // logging to console ✅
      //console.log(field.value); // logging to console ✅
      fieldName = field.name;
      fieldValue = field.value;
    });
    let embed1 = new Discord.MessageEmbed().addFields(fieldName, fieldValue)
    ChannelAprovada.send(embed1)
  })
}
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

You used the MessageEmbed#addFields method (with an s) which requires objects as arguments. Changing it to MessageEmbed#addField should work

let embed1 = new Discord.MessageEmbed()
                .addField(fieldName, fieldValue) //no "s"
about 4 years ago · Juan Pablo Isaza Report

0

Try another.

.addFields({ name: `text`, value: `text`})

For discord v.13

.addField("text", "text")
about 4 years ago · Juan Pablo Isaza Report

0

As @MrMythical said, changing MessageEmbed#addFields to MessageEmbed#addField should help you, but instead of .addField(fieldName, fieldValue) try to use .addField(fieldName, `** ** ${fieldValue}`)! Using ** ** should help you prevent getting an error even if your fieldValue is empty for some reason!

Also in discord.js v13 you have to use ChannelAprovada.send({embeds: [embed1]}) instead of ChannelAprovada.send(embed1) to send an embed!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!