diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index c522050619fd..df77541a43a1 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2186,7 +2186,7 @@ export class Message extends Base { public removeAttachments(): Promise>; public reply(options: string | MessagePayload | MessageReplyOptions): Promise>; public resolveComponent(customId: string): MessageActionRowComponent | null; - public startThread(options: StartThreadOptions): Promise; + public startThread(options: StartThreadOptions): Promise>; public suppressEmbeds(suppress?: boolean): Promise>; public toJSON(): unknown; public toString(): string; @@ -3249,7 +3249,9 @@ export class TextChannel extends BaseGuildTextChannel { public type: ChannelType.GuildText; } -export type AnyThreadChannel = PublicThreadChannel | PrivateThreadChannel; +export type ForumThreadChannel = PublicThreadChannel; +export type TextThreadChannel = PublicThreadChannel | PrivateThreadChannel; +export type AnyThreadChannel = TextThreadChannel | ForumThreadChannel; export interface PublicThreadChannel extends ThreadChannel { type: ChannelType.PublicThread | ChannelType.AnnouncementThread; @@ -3298,9 +3300,9 @@ export class ThreadChannel extends BaseCha public type: ThreadChannelType; public get unarchivable(): boolean; public delete(reason?: string): Promise; - public edit(options: ThreadEditOptions): Promise; - public join(): Promise; - public leave(): Promise; + public edit(options: ThreadEditOptions): Promise; + public join(): Promise; + public leave(): Promise; public permissionsFor(memberOrRole: GuildMember | Role, checkAdmin?: boolean): Readonly; public permissionsFor( memberOrRole: GuildMemberResolvable | RoleResolvable, @@ -3308,18 +3310,15 @@ export class ThreadChannel extends BaseCha ): Readonly | null; public fetchOwner(options?: BaseFetchOptions): Promise; public fetchStarterMessage(options?: BaseFetchOptions): Promise | null>; - public setArchived(archived?: boolean, reason?: string): Promise; - public setAutoArchiveDuration( - autoArchiveDuration: ThreadAutoArchiveDuration, - reason?: string, - ): Promise; - public setInvitable(invitable?: boolean, reason?: string): Promise; - public setLocked(locked?: boolean, reason?: string): Promise; - public setName(name: string, reason?: string): Promise; + public setArchived(archived?: boolean, reason?: string): Promise; + public setAutoArchiveDuration(autoArchiveDuration: ThreadAutoArchiveDuration, reason?: string): Promise; + public setInvitable(invitable?: boolean, reason?: string): Promise; + public setLocked(locked?: boolean, reason?: string): Promise; + public setName(name: string, reason?: string): Promise; // The following 3 methods can only be run on forum threads. - public setAppliedTags(appliedTags: readonly Snowflake[], reason?: string): Promise>; - public pin(reason?: string): Promise>; - public unpin(reason?: string): Promise>; + public setAppliedTags(appliedTags: readonly Snowflake[], reason?: string): Promise>; + public pin(reason?: string): Promise>; + public unpin(reason?: string): Promise>; public toString(): ChannelMention; } @@ -4568,7 +4567,7 @@ export class StageInstanceManager extends CachedManager extends CachedManager< Snowflake, - ThreadChannel, + If, ThreadChannelResolvable > { protected constructor( @@ -4576,7 +4575,10 @@ export class ThreadManager extends CachedM iterable?: Iterable, ); public channel: If; - public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise; + public fetch( + options: ThreadChannelResolvable, + cacheOptions?: BaseFetchOptions, + ): Promise | null>; public fetch( options: FetchThreadsOptions & { archived: FetchArchivedThreadOptions }, cacheOptions?: { cache?: boolean }, @@ -4587,11 +4589,13 @@ export class ThreadManager extends CachedM } export class GuildTextThreadManager extends ThreadManager { - public create(options: GuildTextThreadCreateOptions): Promise; + public create( + options: GuildTextThreadCreateOptions, + ): Promise>; } export class GuildForumThreadManager extends ThreadManager { - public create(options: GuildForumThreadCreateOptions): Promise; + public create(options: GuildForumThreadCreateOptions): Promise; } export class ThreadMemberManager extends CachedManager { @@ -6792,7 +6796,8 @@ export type Channel = | NewsChannel | StageChannel | TextChannel - | AnyThreadChannel + | PublicThreadChannel + | PrivateThreadChannel | VoiceChannel | ForumChannel | MediaChannel; @@ -6822,7 +6827,7 @@ export type TextChannelResolvable = Snowflake | TextChannel; export type TextBasedChannelResolvable = Snowflake | TextBasedChannel; -export type ThreadChannelResolvable = AnyThreadChannel | Snowflake; +export type ThreadChannelResolvable = Snowflake | ThreadChannel; export type ThreadChannelType = ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread; diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index f2db5f9a6f58..2665cf028457 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -230,6 +230,10 @@ const client: Client = new Client({ maxSize: 200, keepOverLimit: member => member.id === client.user?.id, }, + ThreadManager: { + maxSize: 200, + keepOverLimit: value => !value.archived, + }, }), });