mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 17:21:31 +00:00
Rip, fixes a bug we didn't even know to look for... 1870 lives on. (#1931)
possibly fixes #1870
This commit is contained in:
parent
26c978c465
commit
c2029a66e9
1 changed files with 4 additions and 3 deletions
|
|
@ -90,17 +90,18 @@ class GuildMemberStore extends DataStore {
|
||||||
*/
|
*/
|
||||||
fetch(options) {
|
fetch(options) {
|
||||||
if (!options) return this._fetchMany();
|
if (!options) return this._fetchMany();
|
||||||
const user = this.resolveID(options);
|
const user = this.client.users.resolveID(options);
|
||||||
if (user) return this._fetchSingle({ user, cache: true });
|
if (user) return this._fetchSingle({ user, cache: true });
|
||||||
if (options.user) {
|
if (options.user) {
|
||||||
options.user = this.resolveID(options.user);
|
options.user = this.client.users.resolveID(options.user);
|
||||||
if (options.user) return this._fetchSingle(options);
|
if (options.user) return this._fetchSingle(options);
|
||||||
}
|
}
|
||||||
return this._fetchMany(options);
|
return this._fetchMany(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
_fetchSingle({ user, cache }) {
|
_fetchSingle({ user, cache }) {
|
||||||
if (this.has(user)) return Promise.resolve(this.get(user));
|
const existing = this.get(user);
|
||||||
|
if (existing) return Promise.resolve(existing);
|
||||||
return this.client.api.guilds(this.guild.id).members(user).get()
|
return this.client.api.guilds(this.guild.id).members(user).get()
|
||||||
.then(data => this.create(data, cache));
|
.then(data => this.create(data, cache));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue