mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
refactor: more oop with stores (#2216)
* refactor: more oop with stores * forgot bulk delete * Revert "forgot bulk delete" This reverts commit 1b4fb999ee07b358ee6e1af9efb8981b84f83af1. * appease linter * missed some shh * fail
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
const Emoji = require('./Emoji');
|
||||
const ReactionEmoji = require('./ReactionEmoji');
|
||||
const ReactionUserStore = require('../stores/ReactionUserStore');
|
||||
const { Error } = require('../errors');
|
||||
|
||||
/**
|
||||
* Represents a reaction to a message.
|
||||
@@ -56,27 +55,6 @@ class MessageReaction {
|
||||
return this._emoji;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a user from this reaction.
|
||||
* @param {UserResolvable} [user=this.message.client.user] The user to remove the reaction of
|
||||
* @returns {Promise<MessageReaction>}
|
||||
*/
|
||||
remove(user = this.message.client.user) {
|
||||
const userID = this.message.client.users.resolveID(user);
|
||||
if (!userID) return Promise.reject(new Error('REACTION_RESOLVE_USER'));
|
||||
return this.message.client.api.channels[this.message.channel.id].messages[this.message.id]
|
||||
.reactions[this.emoji.identifier][userID === this.message.client.user.id ? '@me' : userID]
|
||||
.delete()
|
||||
.then(() =>
|
||||
this.message.client.actions.MessageReactionRemove.handle({
|
||||
user_id: userID,
|
||||
message_id: this.message.id,
|
||||
emoji: this.emoji,
|
||||
channel_id: this.message.channel.id,
|
||||
}).reaction
|
||||
);
|
||||
}
|
||||
|
||||
_add(user) {
|
||||
if (!this.users.has(user.id)) {
|
||||
this.users.set(user.id, user);
|
||||
|
||||
Reference in New Issue
Block a user