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(ThreadChannel): Address parameter type on fetchOwner() #10579

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 8 additions & 2 deletions packages/discord.js/src/structures/ThreadChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,17 @@ class ThreadChannel extends BaseChannel {
return this.parent?.permissionsFor(memberOrRole, checkAdmin) ?? null;
}

/**
* Options used to fetch a thread member owner.
Jiralite marked this conversation as resolved.
Show resolved Hide resolved
* @typedef {BaseFetchOptions} FetchThreadOwnerOptions
* @property {boolean} [withMember] Whether to also return the guild member associated with this thread member
*/

/**
* Fetches the owner of this thread. If the thread member object isn't needed,
* use {@link ThreadChannel#ownerId} instead.
* @param {BaseFetchOptions} [options] The options for fetching the member
* @returns {Promise<?ThreadMember>}
* @param {FetchThreadOwnerOptions} [options] Options for fetching the owner
* @returns {Promise<ThreadMember>}
*/
async fetchOwner(options) {
if (!this.ownerId) {
Expand Down
6 changes: 5 additions & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3315,7 +3315,7 @@ export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseCha
memberOrRole: GuildMemberResolvable | RoleResolvable,
checkAdmin?: boolean,
): Readonly<PermissionsBitField> | null;
public fetchOwner(options?: BaseFetchOptions): Promise<ThreadMember | null>;
public fetchOwner(options?: FetchThreadOwnerOptions): Promise<ThreadMember>;
public fetchStarterMessage(options?: BaseFetchOptions): Promise<Message<true> | null>;
public setArchived(archived?: boolean, reason?: string): Promise<this>;
public setAutoArchiveDuration(autoArchiveDuration: ThreadAutoArchiveDuration, reason?: string): Promise<this>;
Expand Down Expand Up @@ -5560,6 +5560,10 @@ export interface FetchThreadMemberOptions extends BaseFetchOptions {
withMember?: boolean;
}

export interface FetchThreadOwnerOptions extends BaseFetchOptions {
withMember?: boolean;
}

export interface FetchThreadMembersWithGuildMemberDataOptions {
withMember: true;
after?: Snowflake;
Expand Down