Update UserManager.js

This commit is contained in:
Elysia 2024-01-13 19:31:22 +07:00
parent ce5143bf9b
commit 1583c399c3

View File

@ -60,12 +60,11 @@ class UserManager extends CachedManager {
data: { data: {
recipients: [id], recipients: [id],
}, },
headers: { DiscordContext: {},
'X-Context-Properties': 'e30=', // {}
},
}); });
const dm_channel = await this.client.channels._add(data, null, { cache }); const dm_channel = await this.client.channels._add(data, null, { cache });
await dm_channel.sync(); dm_channel.sync();
return dm_channel; return dm_channel;
} }
@ -87,10 +86,9 @@ class UserManager extends CachedManager {
* Obtains a user from Discord, or the user cache if it's already available. * Obtains a user from Discord, or the user cache if it's already available.
* @param {UserResolvable} user The user to fetch * @param {UserResolvable} user The user to fetch
* @param {BaseFetchOptions} [options] Additional options for this fetch * @param {BaseFetchOptions} [options] Additional options for this fetch
* @param {?Snowflake} [options.guildId] The guild ID to fetch the member for
* @returns {Promise<User>} * @returns {Promise<User>}
*/ */
async fetch(user, { cache = true, force = false, guildId = null } = {}) { async fetch(user, { cache = true, force = false } = {}) {
const id = this.resolveId(user); const id = this.resolveId(user);
if (!force) { if (!force) {
const existing = this.cache.get(id); const existing = this.cache.get(id);
@ -98,9 +96,7 @@ class UserManager extends CachedManager {
} }
const data = await this.client.api.users(id).get(); const data = await this.client.api.users(id).get();
const userObject = this._add(data, cache); return this._add(data, cache);
await userObject.getProfile(guildId ?? null).catch(() => {});
return userObject;
} }
/** /**