mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 17:52:55 +00:00
Fix reaction events (#1105)
* Fix reaction events * Made it better * one line ftw
This commit is contained in:
parent
8c220e76ec
commit
f8b9bf6884
1 changed files with 5 additions and 8 deletions
|
|
@ -540,7 +540,7 @@ class Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
_addReaction(emoji, user) {
|
_addReaction(emoji, user) {
|
||||||
const emojiID = emoji.identifier;
|
const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : encodeURIComponent(emoji.name);
|
||||||
let reaction;
|
let reaction;
|
||||||
if (this.reactions.has(emojiID)) {
|
if (this.reactions.has(emojiID)) {
|
||||||
reaction = this.reactions.get(emojiID);
|
reaction = this.reactions.get(emojiID);
|
||||||
|
|
@ -549,16 +549,13 @@ class Message {
|
||||||
reaction = new MessageReaction(this, emoji, 0, user.id === this.client.user.id);
|
reaction = new MessageReaction(this, emoji, 0, user.id === this.client.user.id);
|
||||||
this.reactions.set(emojiID, reaction);
|
this.reactions.set(emojiID, reaction);
|
||||||
}
|
}
|
||||||
if (!reaction.users.has(user.id)) {
|
if (!reaction.users.has(user.id)) reaction.users.set(user.id, user);
|
||||||
reaction.users.set(user.id, user);
|
reaction.count++;
|
||||||
reaction.count++;
|
return reaction;
|
||||||
return reaction;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_removeReaction(emoji, user) {
|
_removeReaction(emoji, user) {
|
||||||
const emojiID = emoji.identifier;
|
const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : encodeURIComponent(emoji.name);
|
||||||
if (this.reactions.has(emojiID)) {
|
if (this.reactions.has(emojiID)) {
|
||||||
const reaction = this.reactions.get(emojiID);
|
const reaction = this.reactions.get(emojiID);
|
||||||
if (reaction.users.has(user.id)) {
|
if (reaction.users.has(user.id)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue