Winnex
Winnex
DIAdiscord.js - Imagine an app
Created by Winnex on 12/23/2023 in #djs-questions
Editing embeds to preserve original content
I have this set into an embed builder in a listener.ts file:
.setDescription(`Ansøgning fra <@${interactionUser.id}>`)
.addFields(
{ name: 'Hvad er din alder?', value: alder, inline: true },
{ name: 'Hvor mange timer har du på FiveM?', value: timer, inline: true },
{ name: 'Hvor har du RP erfaring fra?', value: erfaring, inline: false },
{ name: 'Hvorfor vil du gerne ind på serveren?', value: hvorfor, inline: false },
{ name: 'Hvordan bidrager din karakter til serveren?', value: baggrund, inline: false })
.setTimestamp()
.setDescription(`Ansøgning fra <@${interactionUser.id}>`)
.addFields(
{ name: 'Hvad er din alder?', value: alder, inline: true },
{ name: 'Hvor mange timer har du på FiveM?', value: timer, inline: true },
{ name: 'Hvor har du RP erfaring fra?', value: erfaring, inline: false },
{ name: 'Hvorfor vil du gerne ind på serveren?', value: hvorfor, inline: false },
{ name: 'Hvordan bidrager din karakter til serveren?', value: baggrund, inline: false })
.setTimestamp()
This is where I handle editing the embed, I want to preserve the original fields added into it, when the application is accepted, so it keeps all the content, but just edits the embed, appending the accepted status above the original content. Does this mean I have to addFields all the content again when accepting below? If so, how do I do this? Or how can I achieve the desired functionality?
// Create a new instance of EmbedBuilder
const editedEmbed = new EmbedBuilder();

// Edit the original embed to show the accepted message
editedEmbed.setColor(0x7ACB0C)
.setTitle('Accepteret!')
.setDescription(`<@${user.id}> Allowlist ansøgning er blevet godkendt af <@${interaction.user.id}>!`)
.setTimestamp();

// Update the message with the modified embed
await interaction.message.edit({ embeds: [editedEmbed] });
// Create a new instance of EmbedBuilder
const editedEmbed = new EmbedBuilder();

// Edit the original embed to show the accepted message
editedEmbed.setColor(0x7ACB0C)
.setTitle('Accepteret!')
.setDescription(`<@${user.id}> Allowlist ansøgning er blevet godkendt af <@${interaction.user.id}>!`)
.setTimestamp();

// Update the message with the modified embed
await interaction.message.edit({ embeds: [editedEmbed] });
19 replies