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.