diff --git a/src/managers/ThreadManager.js b/src/managers/ThreadManager.js
index d744fef06e31..1df19e6fc590 100644
--- a/src/managers/ThreadManager.js
+++ b/src/managers/ThreadManager.js
@@ -66,7 +66,8 @@ class ThreadManager extends CachedManager {
* * `1440` (1 day)
* * `4320` (3 days) This is only available when the guild has the `THREE_DAY_THREAD_ARCHIVE` feature.
* * `10080` (7 days) This is only available when the guild has the `SEVEN_DAY_THREAD_ARCHIVE` feature.
- * @typedef {number} ThreadAutoArchiveDuration
+ * * `'MAX'` Based on the guilds boost count
+ * @typedef {number|string} ThreadAutoArchiveDuration
*/
/**
@@ -119,6 +120,14 @@ class ThreadManager extends CachedManager {
} else if (this.channel.type !== 'GUILD_NEWS') {
resolvedType = typeof type === 'string' ? ChannelTypes[type] : type ?? resolvedType;
}
+ if (autoArchiveDuration === 'MAX') {
+ autoArchiveDuration = 1440;
+ if (this.channel.guild.features.includes('SEVEN_DAY_THREAD_ARCHIVE')) {
+ autoArchiveDuration = 10080;
+ } else if (this.channel.guild.features.includes('THREE_DAY_THREAD_ARCHIVE')) {
+ autoArchiveDuration = 4320;
+ }
+ }
const data = await path.threads.post({
data: {
diff --git a/src/structures/ThreadChannel.js b/src/structures/ThreadChannel.js
index c7c7b30f4565..b098c15322de 100644
--- a/src/structures/ThreadChannel.js
+++ b/src/structures/ThreadChannel.js
@@ -276,11 +276,20 @@ class ThreadChannel extends Channel {
* .catch(console.error);
*/
async edit(data, reason) {
+ let autoArchiveDuration = data.autoArchiveDuration;
+ if (data.autoArchiveDuration === 'MAX') {
+ autoArchiveDuration = 1440;
+ if (this.guild.features.includes('SEVEN_DAY_THREAD_ARCHIVE')) {
+ autoArchiveDuration = 10080;
+ } else if (this.guild.features.includes('THREE_DAY_THREAD_ARCHIVE')) {
+ autoArchiveDuration = 4320;
+ }
+ }
const newData = await this.client.api.channels(this.id).patch({
data: {
name: (data.name ?? this.name).trim(),
archived: data.archived,
- auto_archive_duration: data.autoArchiveDuration,
+ auto_archive_duration: autoArchiveDuration,
rate_limit_per_user: data.rateLimitPerUser,
locked: data.locked,
},
diff --git a/typings/index.d.ts b/typings/index.d.ts
index a7ae474076b3..57c369694467 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -4429,7 +4429,7 @@ export type TextBasedChannelTypes = TextBasedChannels['type'];
export type TextChannelResolvable = Snowflake | TextChannel;
-export type ThreadAutoArchiveDuration = 60 | 1440 | 4320 | 10080;
+export type ThreadAutoArchiveDuration = 60 | 1440 | 4320 | 10080 | 'MAX';
export type ThreadChannelResolvable = ThreadChannel | Snowflake;