mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
refactor: new node features (#5132)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
@@ -105,9 +105,9 @@ class MessageReaction {
|
||||
*/
|
||||
async fetch() {
|
||||
const message = await this.message.fetch();
|
||||
const existing = message.reactions.cache.get(this.emoji.id || this.emoji.name);
|
||||
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 });
|
||||
this._patch(existing ?? { count: 0 });
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class MessageReaction {
|
||||
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.users.cache.size === 0) {
|
||||
this.message.reactions.cache.delete(this.emoji.id || this.emoji.name);
|
||||
this.message.reactions.cache.delete(this.emoji.id ?? this.emoji.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user