Moving from v13, autoArchiveDuration no longer accepts 'MAX' as it requires int32

Hi! I'm working on migrating from v13 to v14, everything is going well except for one specific thing. autoArchiveDuration (for thread creation) no longer accepts 'MAX' as a value, as it requires an int32 value, however I cannot find the replacement value for 'the maximum' anywhere. Can somebody tell me how I can select the maximum possible length? The premium subscription count can vary in this server, so I prefer it automatically selecting the highest possible value. Thanks in advance!
8 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Solo
Solo11mo ago
Package version: v14.11.0 Node version: v16.16.0 Code:
const thread = await message.channel.threads.create({
name: `Thread by ${message.member.displayName}`,
autoArchiveDuration: 'MAX'
});
const thread = await message.channel.threads.create({
name: `Thread by ${message.member.displayName}`,
autoArchiveDuration: 'MAX'
});
Error:
Unhandled promise rejection: DiscordAPIError[50035]: Invalid Form Body
auto_archive_duration[NUMBER_TYPE_COERCE]: Value "MAX" is not int32.
Unhandled promise rejection: DiscordAPIError[50035]: Invalid Form Body
auto_archive_duration[NUMBER_TYPE_COERCE]: Value "MAX" is not int32.
d.js docs
d.js docs11mo ago
interface ThreadCreateOptions Options for creating a thread. (more...)
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Solo
Solo11mo ago
Yep I found that, problem is it only has these four values
Solo
Solo11mo ago
Where you were previously able to pass 'MAX' as a value, which was cool because it would automatically select the highest value for you I'm guessing if I just do OneWeek as a value, it'll automatically scale it down if I don't have enough boosts, but that's a bit of an ugly fix
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Solo
Solo11mo ago
Ahhh gotcha, awesome, thanks! And definitely agree on the enum part, just couldn't find the deprecation replacement anywhere. Cheers, have a nice evening!