Skip to content

Commit

Permalink
feat(UserManager): allow #fetch to take UserResolvable (#6677)
Browse files Browse the repository at this point in the history
  • Loading branch information
iShibi committed Sep 26, 2021
1 parent 1ca8d2c commit a06a87a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/managers/UserManager.js
Expand Up @@ -56,11 +56,12 @@ class UserManager extends CachedManager {

/**
* Obtains a user from Discord, or the user cache if it's already available.
* @param {Snowflake} id The user's id
* @param {UserResolvable} user The user to fetch
* @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<User>}
*/
async fetch(id, { cache = true, force = false } = {}) {
async fetch(user, { cache = true, force = false } = {}) {
const id = this.resolveId(user);
if (!force) {
const existing = this.cache.get(id);
if (existing && !existing.partial) return existing;
Expand Down
2 changes: 1 addition & 1 deletion typings/index.d.ts
Expand Up @@ -2770,7 +2770,7 @@ export class ThreadMemberManager extends CachedManager<Snowflake, ThreadMember,

export class UserManager extends CachedManager<Snowflake, User, UserResolvable> {
public constructor(client: Client, iterable?: Iterable<RawUserData>);
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<User>;
public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<User>;
}

export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, typeof VoiceState> {
Expand Down

0 comments on commit a06a87a

Please sign in to comment.