mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01: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:
@@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user