Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

364
Vistas
How to edit embed field value in Discord.js V13

So I am trying to edit one field in an embed. The fetched embed looks like this:

MessageEmbed {
  type: 'rich',
  title: null,
  description: null,
  url: null,
  color: 5763719,
  timestamp: null,
  fields: [
    { name: 'Suggestie', value: 'test1', inline: false },
    { name: 'Status', value: 'Open', inline: true },
    { name: 'ID', value: 'SPogb', inline: true },
    { name: 'User ID', value: '291272018773671937', inline: true },
    {
      name: 'Opmerking van staff:',
      value: 'Geen opmerking',
      inline: false
    }
  ],
  thumbnail: null,
  image: null,
  video: null,
  author: {
    name: 'Nigel#7777',
    url: undefined,
    iconURL: 'https://cdn.discordapp.com/avatars/291272018773671937/b2637472f4502b2b2280b6302d3f666c.webp',
    proxyIconURL: 'https://images-ext-1.discordapp.net/external/I_MfeMd6YbK_NxsY_kG-k7P6hiytpXx3tNk9ZJdd9lg/https/cdn.discordapp.com/avatars/291272018773671937/b2637472f4502b2b2280b6302d3f666c.webp'
  },
  provider: null,
  footer: null
}

I am trying to edit the Status field value from Open to Approved, but I have no idea how to achieve this. I currently have:

const kanaal = interaction.guild.channels.cache.get(config.kanalen.suggestieKanaal)
        const ID = interaction.options.getString('id');
        let correcteSuggest;
        kanaal.messages.fetch({limit: 50}).then(messages => {
            const botMessages = messages.filter(msg => msg.author.bot);
            botMessages.forEach(msg => {
                if(msg.embeds[0].fields[2].value === interaction.options.getString('id')) {
                    correcteSuggest = msg;
                }
            })
            console.log(correcteSuggest.embeds[0].fields)
            // correcteSuggest.edit(embeds[0].fields[1] = ({name: "Status", value: "Approved", inline: true}))
            // const editedEmbed = new Discord.MessageEmbed(correcteSuggest.embeds[0]).fields[3]



        })

The commented stuff I tried but did not seem to work. I have seen other people get the embed and do like .setDescription, but I don't know how that would work with .setField since there are more then one fields.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Fixed this by doing:

correcteSuggest.embeds[0].fields.find(f => f.name === "Status").value = "Approved";

correcteSuggest.edit({embeds: [correcteSuggest.embeds[0]]})
about 4 years ago · Juan Pablo Isaza Denunciar

0

your logic of editing the embed is right but the way is wrong. Discord.JS doesn't actually just update one field, it updates the whole message so we'll need to change the way to a whole new MessageEmbed.

const kanaal = interaction.guild.channels.cache.get(config.kanalen.suggestieKanaal)
const ID = interaction.options.getString('id');
let correcteSuggest;
kanaal.messages.fetch({
    limit: 50
}).then(messages => {
    const botMessages = messages.filter(msg => msg.author.bot);
    botMessages.forEach(msg => {
        if (msg.embeds[0].fields[2].value === interaction.options.getString('id')) {
            correcteSuggest = msg;
        }
    })
    if (correcteSuggest.embeds[0]) {
        const editedEmbed = new Discord.MessageEmbed(correcteSuggest.embeds[0]);
        editedEmbed.fields[1].value = "Approved";
        correcteSuggest.edit({
            embeds: [editedEmbed]
        });
    }
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda