Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ThreadMember): remove audit log reason parameter #10023

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>}
Renegade334 marked this conversation as resolved.
Show resolved Hide resolved
*/
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 @@ -3396,7 +3396,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 @@ -4668,7 +4668,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 @@ -4682,7 +4682,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