mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
Datastore cleanup (#1892)
* Start Store cleanup * wip store cleanup * fix iterables initiating datastores * handle the possibility of a datastore with no holds and no its own 'create' method * more cleanup (instances that need more than just client/data) * missed RoleStore extras * not sure how eslint didn't catch that tab... * avoid re-getting the channel we already have... * cleanup resolvers and refactor them into DataStores * ^ * and remove * fix some bugs * fix lint * fix documentation maybe? * formatting * fix presences * really fix presences this time * bad fix was bad... let;s see how bad this one is.. * forgot to save a file * make presence resolving take userresolveables too * fix tabs in jsdocs * fix bad fix from last night that caused issues, with better fix... * oops
This commit is contained in:
@@ -7,7 +7,7 @@ const { Error } = require('../errors');
|
||||
* Represents a reaction to a message.
|
||||
*/
|
||||
class MessageReaction {
|
||||
constructor(message, emoji, count, me) {
|
||||
constructor(client, data, message) {
|
||||
/**
|
||||
* The message that this reaction refers to
|
||||
* @type {Message}
|
||||
@@ -18,13 +18,13 @@ class MessageReaction {
|
||||
* Whether the client has given this reaction
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.me = me;
|
||||
this.me = data.me;
|
||||
|
||||
/**
|
||||
* The number of people that have given the same reaction
|
||||
* @type {number}
|
||||
*/
|
||||
this.count = count || 0;
|
||||
this.count = data.count || 0;
|
||||
|
||||
/**
|
||||
* The users that have given this reaction, mapped by their ID
|
||||
@@ -32,7 +32,7 @@ class MessageReaction {
|
||||
*/
|
||||
this.users = new Collection();
|
||||
|
||||
this._emoji = new ReactionEmoji(this, emoji.name, emoji.id);
|
||||
this._emoji = new ReactionEmoji(this, data.emoji.name, data.emoji.id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ class MessageReaction {
|
||||
* @returns {Promise<MessageReaction>}
|
||||
*/
|
||||
remove(user = this.message.client.user) {
|
||||
const userID = this.message.client.resolver.resolveUserID(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]
|
||||
|
||||
Reference in New Issue
Block a user