mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
fix(MessageReaction): inaccurate count
also works towards async rewrite goal fixes #2404
This commit is contained in:
@@ -62,21 +62,17 @@ class MessageReaction {
|
||||
}
|
||||
|
||||
_add(user) {
|
||||
if (!this.users.has(user.id)) {
|
||||
this.users.set(user.id, user);
|
||||
if (!this.me || user.id !== this.message.client.user.id) this.count++;
|
||||
}
|
||||
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.users.has(user.id)) {
|
||||
this.users.delete(user.id);
|
||||
this.count--;
|
||||
if (user.id === this.message.client.user.id) this.me = false;
|
||||
if (this.count <= 0) {
|
||||
this.message.reactions.remove(this.emoji.id || this.emoji.name);
|
||||
}
|
||||
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;
|
||||
if (this.count <= 0) {
|
||||
this.message.reactions.remove(this.emoji.id || this.emoji.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user