Skip to content

Commit

Permalink
fix(ThreadMember): remove audit log reason
Browse files Browse the repository at this point in the history
  • Loading branch information
Renegade334 committed Dec 29, 2023
1 parent 4824ac1 commit 19b93a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
10 changes: 4 additions & 6 deletions packages/discord.js/src/managers/ThreadMemberManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,24 @@ class ThreadMemberManager extends CachedManager {
/**
* Adds a member to the thread.
* @param {UserResolvable|'@me'} member The member to add
* @param {string} [reason] The reason for adding this member
* @returns {Promise<Snowflake>}
*/
async add(member, reason) {
async add(member) {
const id = member === '@me' ? member : this.client.users.resolveId(member);
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'member', 'UserResolvable');
await this.client.rest.put(Routes.threadMembers(this.thread.id, id), { reason });
await this.client.rest.put(Routes.threadMembers(this.thread.id, id));
return id;
}

/**
* Remove a user from the thread.
* @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(member, reason) {
async remove(member) {
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 });
await this.client.rest.delete(Routes.threadMembers(this.thread.id, id));
return id;
}

Expand Down
5 changes: 2 additions & 3 deletions packages/discord.js/src/structures/ThreadMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ class ThreadMember extends Base {

/**
* Removes this member from the thread.
* @param {string} [reason] Reason for removing the member
* @returns {Promise<ThreadMember>}
*/
async remove(reason) {
await this.thread.members.remove(this.id, reason);
async remove() {
await this.thread.members.remove(this.id);
return this;
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3208,7 +3208,7 @@ export class ThreadMember<HasMemberData extends boolean = boolean> extends Base
public thread: AnyThreadChannel;
public get user(): User | null;
public get partial(): false;
public remove(reason?: string): Promise<ThreadMember>;
public remove(): Promise<ThreadMember>;
}

export type ThreadMemberFlagsString = keyof typeof ThreadMemberFlags;
Expand Down Expand Up @@ -4426,7 +4426,7 @@ export class ThreadMemberManager extends CachedManager<Snowflake, ThreadMember,
private constructor(thread: ThreadChannel, iterable?: Iterable<RawThreadMemberData>);
public thread: AnyThreadChannel;
public get me(): ThreadMember | null;
public add(member: UserResolvable | '@me', reason?: string): Promise<Snowflake>;
public add(member: UserResolvable | '@me'): Promise<Snowflake>;

public fetch(
options: ThreadMember<true> | ((FetchThreadMemberOptions & { withMember: true }) | { member: ThreadMember<true> }),
Expand All @@ -4440,7 +4440,7 @@ export class ThreadMemberManager extends CachedManager<Snowflake, ThreadMember,

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

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

0 comments on commit 19b93a2

Please sign in to comment.