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:
Isabella
2018-01-11 10:33:30 -06:00
committed by Amish Shah
parent 90fc161159
commit 9eac19d9d8
38 changed files with 364 additions and 359 deletions

View File

@@ -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);