mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
feat(Threads): max autoArchiveDuration option (#6304)
Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
committed by
GitHub
parent
d87299ba20
commit
394d48649f
@@ -66,7 +66,8 @@ class ThreadManager extends CachedManager {
|
||||
* * `1440` (1 day)
|
||||
* * `4320` (3 days) <warn>This is only available when the guild has the `THREE_DAY_THREAD_ARCHIVE` feature.</warn>
|
||||
* * `10080` (7 days) <warn>This is only available when the guild has the `SEVEN_DAY_THREAD_ARCHIVE` feature.</warn>
|
||||
* @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: {
|
||||
|
||||
Reference in New Issue
Block a user