option for sync get userwrapper
This commit is contained in:
parent
60422ea3c6
commit
1b291d1236
@ -234,15 +234,28 @@ class DiscordClient extends Client {
|
||||
|
||||
}
|
||||
|
||||
async getUserWrapper(id) {
|
||||
getUserWrapper(id, fetch = true) {
|
||||
|
||||
if (this.userWrappers.has(id)) return this.userWrappers.get(id);
|
||||
|
||||
const user = await this.users.fetch(id);
|
||||
if (!fetch) {
|
||||
const user = this.users.cache.get(id);
|
||||
const wrapper = new UserWrapper(this, user);
|
||||
this.userWrappers.set(id, wrapper);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
this.users.fetch(id).then((user) => {
|
||||
const wrapper = new UserWrapper(this, user);
|
||||
this.userWrappers.set(id, wrapper);
|
||||
resolve(wrapper);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
get prefix() {
|
||||
return this._options.discord.prefix;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user