Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

javascript - Embed message doesn't update

I want to make a vote with an embed message.
When someone adds a reaction, I want to add a like and to show the number of likes in the embed. Here an example:
Example

Whenever someone clicks on like, all my code lines work and I finally change the Field value linked to like just like that :

messageReaction.message.embeds[0].fields[0] = "Some much like";

But the embed message doesn't update.
I've tried to update the message with this:

function doAfakeEdit(message){
  message.edit(message.content);
}

It still keeps the old value of the field.
What should I do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Very late answer. But just in case someone finds this. Theres a much shorter way.

And more useful if you have large embeds and don't want to rebuild your whole embed:

message.embeds[0].fields[0] = "Some much like";
message.edit(new Discord.RichEmbed(message.embeds[0]));

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...