Skip to content

Commit

Permalink
refactor(ThreadMemberManager): #remove accepts UserResolvable (#10000)
Browse files Browse the repository at this point in the history
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
  • Loading branch information
Renegade334 and Jiralite authored Dec 1, 2023
1 parent e412a22 commit 179af38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/discord.js/src/managers/ThreadMemberManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Snowflake>}
*/
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;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4321,7 +4321,7 @@ export class ThreadMemberManager extends CachedManager<Snowflake, ThreadMember,

public fetch(options?: FetchThreadMembersWithoutGuildMemberDataOptions): Promise<Collection<Snowflake, ThreadMember>>;
public fetchMe(options?: BaseFetchOptions): Promise<ThreadMember>;
public remove(id: Snowflake | '@me', reason?: string): Promise<Snowflake>;
public remove(member: UserResolvable | '@me', reason?: string): Promise<Snowflake>;
}

export class UserManager extends CachedManager<Snowflake, User, UserResolvable> {
Expand Down

0 comments on commit 179af38

Please sign in to comment.