From 933ff274b98ddafacba86b136392d6874950c23b Mon Sep 17 00:00:00 2001 From: Renegade334 Date: Sat, 25 Nov 2023 16:35:25 +0000 Subject: [PATCH] refactor(ThreadMemberManager): #remove accepts UserResolvable --- packages/discord.js/src/managers/ThreadMemberManager.js | 6 ++++-- packages/discord.js/typings/index.d.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/discord.js/src/managers/ThreadMemberManager.js b/packages/discord.js/src/managers/ThreadMemberManager.js index c138aa32854b..e4ae5bf7d49e 100644 --- a/packages/discord.js/src/managers/ThreadMemberManager.js +++ b/packages/discord.js/src/managers/ThreadMemberManager.js @@ -103,11 +103,13 @@ class ThreadMemberManager extends CachedManager { /** * Remove a user from the thread. - * @param {Snowflake|'@me'} id The id of the member to remove + * @param {UserResolvable|'@me'} member The member to remove * @param {string} [reason] The reason for removing this member from the thread * @returns {Promise} */ - async remove(id, reason) { + async remove(member, reason) { + const id = member === '@me' ? member : this.client.users.resolveId(member); + if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'member', 'UserResolvable'); await this.client.rest.delete(Routes.threadMembers(this.thread.id, id), { reason }); return id; } diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 9872a10297c4..5c6caf5dca5a 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -4320,7 +4320,7 @@ export class ThreadMemberManager extends CachedManager>; public fetchMe(options?: BaseFetchOptions): Promise; - public remove(id: Snowflake | '@me', reason?: string): Promise; + public remove(member: UserResolvable | '@me', reason?: string): Promise; } export class UserManager extends CachedManager {