revert: "feat(Partials): add DMChannel/MessageReaction#fetch()… (#3468)

This reverts commit b0047c424b.
This commit is contained in:
Crawl
2019-09-10 19:49:56 +02:00
committed by GitHub
parent dad0cd8e81
commit 321beb73bd
9 changed files with 20 additions and 80 deletions

View File

@@ -27,6 +27,12 @@ class MessageReaction {
*/
this.me = data.me;
/**
* The number of people that have given the same reaction
* @type {number}
*/
this.count = data.count || 0;
/**
* The users that have given this reaction, mapped by their ID
* @type {ReactionUserStore<Snowflake, User>}
@@ -34,16 +40,6 @@ class MessageReaction {
this.users = new ReactionUserStore(client, undefined, this);
this._emoji = new ReactionEmoji(this, data.emoji);
this._patch(data);
}
_patch(data) {
/**
* The number of people that have given the same reaction
* @type {?number}
*/
this.count = typeof data.count === 'number' ? data.count : null;
}
/**
@@ -67,36 +63,18 @@ class MessageReaction {
return this._emoji;
}
/**
* Whether or not this reaction is a partial
* @type {boolean}
* @readonly
*/
get partial() {
return this.count === null;
}
/**
* Fetch this reaction.
* @returns {Promise<MessageReaction>}
*/
fetch() {
return this.message.reactions._fetchReaction(this.emoji, true);
}
toJSON() {
return Util.flatten(this, { emoji: 'emojiID', message: 'messageID' });
}
_add(user) {
if (this.partial) return;
this.users.set(user.id, user);
if (!this.me || user.id !== this.message.client.user.id || this.count === 0) this.count++;
if (!this.me) this.me = user.id === this.message.client.user.id;
}
_remove(user) {
if (this.partial) return;
this.users.delete(user.id);
if (!this.me || user.id !== this.message.client.user.id) this.count--;
if (user.id === this.message.client.user.id) this.me = false;