diff --git a/src/managers/ThreadManager.js b/src/managers/ThreadManager.js index 351fd0c9ffa2..c5c5c458cd8b 100644 --- a/src/managers/ThreadManager.js +++ b/src/managers/ThreadManager.js @@ -58,6 +58,15 @@ class ThreadManager extends BaseManager { * @returns {?Snowflake} */ + /** + * A number that is allowed to be the duration in minutes before a thread is automatically archived. This can be: + * * `60` (1 hour) + * * `1440` (1 day) + * * `4320` (3 days) + * * `10080` (7 days) + * @typedef {number} ThreadAutoArchiveDuration + */ + /** * Creates a new thread in the channel. * @param {string} name The name of the new Thread diff --git a/src/structures/Message.js b/src/structures/Message.js index 80fb9bfe8ea9..320210243abb 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -629,7 +629,7 @@ class Message extends Base { * Create a new public thread from this message * @see ThreadManager#create * @param {string} name The name ofthe new Thread - * @param {number} autoArchiveDuration How long in minutes before the thread is automatically archived + * @param {ThreadAutoArchiveDuration} autoArchiveDuration How long before the thread is automatically archived * @param {string} [reason] Reason for creating the thread * @returns {Promise} */ diff --git a/src/structures/ThreadChannel.js b/src/structures/ThreadChannel.js index dc55ad65bcf1..990bc162128f 100644 --- a/src/structures/ThreadChannel.js +++ b/src/structures/ThreadChannel.js @@ -256,8 +256,7 @@ class ThreadChannel extends Channel { /** * Sets the duration before the channel is automatically archived. - * @param {number} autoArchiveDuration How long in minutes before the thread is automatically archived, - * one of `60`, `1440`, `4320`, or `10080` + * @param {ThreadAutoArchiveDuration} autoArchiveDuration How long before the thread is automatically archived * @param {string} [reason] Reason for changing the archive time * @returns {Promise} * @example diff --git a/typings/index.d.ts b/typings/index.d.ts index 4740d1303375..1358fe144f27 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1192,7 +1192,7 @@ declare module 'discord.js' { public reply(content: StringResolvable, options: ReplyMessageOptions): Promise; public startThread( name: 'string', - autoArchiveDuration: AutoArchiveDuration, + autoArchiveDuration: ThreadAutoArchiveDuration, reason?: string, ): Promise; public suppressEmbeds(suppress?: boolean): Promise; @@ -1710,7 +1710,7 @@ declare module 'discord.js' { public readonly archivedAt: Date; public archiverID: Snowflake | null; public archiveTimestamp: number | null; - public autoArchiveDuration: AutoArchiveDuration; + public autoArchiveDuration: ThreadAutoArchiveDuration; public readonly deletable: boolean; public readonly editable: boolean; public guild: Guild; @@ -1737,7 +1737,10 @@ declare module 'discord.js' { public permissionsFor(memberOrRole: GuildMember | Role): Readonly; public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly | null; public setArchived(archived: boolean, reason?: string): Promise; - public setAutoArchiveDuration(autoArchiveDuration: AutoArchiveDuration, reason?: string): Promise; + public setAutoArchiveDuration( + autoArchiveDuration: ThreadAutoArchiveDuration, + reason?: string, + ): Promise; public setLocked(locked: boolean, reason?: string): Promise; public setName(name: string, reason?: string): Promise; public setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise; @@ -2336,7 +2339,7 @@ declare module 'discord.js' { public channel: TextChannel | NewsChannel; public create( name: string, - autoArchiveDuration: AutoArchiveDuration, + autoArchiveDuration: ThreadAutoArchiveDuration, options?: { startMessage?: MessageResolvable; reason?: string }, ): Promise; public fetch(options: ThreadChannelResolvable, cache?: boolean, force?: boolean): Promise; @@ -2618,7 +2621,7 @@ declare module 'discord.js' { new?: any; } - type AutoArchiveDuration = 60 | 1440 | 4320 | 10080; + type ThreadAutoArchiveDuration = 60 | 1440 | 4320 | 10080; interface AwaitMessagesOptions extends MessageCollectorOptions { errors?: string[]; @@ -3765,7 +3768,7 @@ declare module 'discord.js' { interface ThreadEditData { name?: string; archived?: boolean; - autoArchiveDuration?: AutoArchiveDuration; + autoArchiveDuration?: ThreadAutoArchiveDuration; rateLimitPeruser?: number; locked?: boolean; }