Friday, February 23, 2024
 Popular · Latest · Hot · Upcoming
72
rated 0 times [  75] [ 3]  / answers: 1 / hits: 8527  / 5 Years ago, sun, december 30, 2018, 12:00:00

So let's say I create an embed and sent it to a channel. Here's the embed:



const embed = new Discord.RichEmbed()
.setColor(color)
.setTitle(`${message.author.tag} wants to play.`)
.setAuthor(message.author.tag, message.author.displayAvatarURL)
.setDescription(game)
.setThumbnail(icon)
.addField(`u200bn**React with ${emoji} to join.**`, Remove your reaction to leave.);


Once it's sent, I want to edit that embed's title and description and delete the field I added at the end.



Here's the new embed I'm trying to create:



const embed = new Discord.RichEmbed(reaction.message.embeds[0])
.setTitle(This game has ended.)
.setDescription(You can no longer join.);


This changes the title and description but I'm unsure on how to remove the field that I added too.


More From » discord

 Answers
15

I know this is 6 months old, but in case anyone else stumbles here like I did you should not set embed.fields to null. This prevents new fields from being added later using the addField method. Instead set it to an empty array.



embed.fields = [];

[#9637] Friday, December 28, 2018, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
annaw

Total Points: 18
Total Questions: 91
Total Answers: 98

Location: Guam
Member since Fri, Jun 18, 2021
3 Years ago
;