mirror of
https://github.com/danbulant/discord.js
synced 2026-07-09 05:00:48 +00:00
fix(ReactionUserStore): fetch inconsistency
It should be consistent with MessageStore#fetch now
This commit is contained in:
parent
dfbd4bdde1
commit
09708482f6
1 changed files with 6 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
const Collection = require('../util/Collection');
|
||||||
const DataStore = require('./DataStore');
|
const DataStore = require('./DataStore');
|
||||||
const { Error } = require('../errors');
|
const { Error } = require('../errors');
|
||||||
|
|
||||||
|
|
@ -21,14 +22,16 @@ class ReactionUserStore extends DataStore {
|
||||||
*/
|
*/
|
||||||
async fetch({ limit = 100, after, before } = {}) {
|
async fetch({ limit = 100, after, before } = {}) {
|
||||||
const message = this.reaction.message;
|
const message = this.reaction.message;
|
||||||
const users = await this.client.api.channels[message.channel.id].messages[message.id]
|
const data = await this.client.api.channels[message.channel.id].messages[message.id]
|
||||||
.reactions[this.reaction.emoji.identifier]
|
.reactions[this.reaction.emoji.identifier]
|
||||||
.get({ query: { limit, before, after } });
|
.get({ query: { limit, before, after } });
|
||||||
for (const rawUser of users) {
|
const users = new Collection();
|
||||||
|
for (const rawUser of data) {
|
||||||
const user = this.client.users.add(rawUser);
|
const user = this.client.users.add(rawUser);
|
||||||
this.set(user.id, user);
|
this.set(user.id, user);
|
||||||
|
users.set(user.id, user);
|
||||||
}
|
}
|
||||||
return this;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue