fix(MessageReaction): fetching a removed partial custom emoji (#3955)

* fix: handling GuildEmoji within fetch()

* refactor: remove unused "private" methods

* refactor: make use of Message#fetch() to patch
This commit is contained in:
izexi
2020-03-17 17:52:43 +00:00
committed by GitHub
parent 2be9ebaad2
commit a36a65b36a
2 changed files with 6 additions and 28 deletions

View File

@@ -101,8 +101,12 @@ class MessageReaction {
* Fetch this reaction.
* @returns {Promise<MessageReaction>}
*/
fetch() {
return this.message.reactions._fetchReaction(this.emoji, true);
async fetch() {
const message = await this.message.fetch();
const existing = message.reactions.cache.get(this.emoji.id || this.emoji.name);
// The reaction won't get set when it has been completely removed
this._patch(existing || { count: 0 });
return this;
}
toJSON() {