Home > OS >  "DiscordAPIError: Guild premium subscription level too low" on Thread Creation
"DiscordAPIError: Guild premium subscription level too low" on Thread Creation

Time:01-15

I've been trying to create a public thread with the library "discord.js": "^13.1.0" in TypeScript. I've been searching and discovered that private threads require a level of discord premium subscription, but I'm using GUILD_PUBLIC_THREAD as the thread type, so the error shouldn't exist.

I've searched through the docs for discord API, discord.js and its guide but found nothing, here's the code for the thread creation.

let threadChannel : ThreadChannel = await message.channel.threads.create({
            name: `Doubt of ${nick}`,
            autoArchiveDuration: 10080,
            type: "GUILD_PUBLIC_THREAD",
            startMessage: message.id,
        })

and here's the error:

DiscordAPIError: Guild premium subscription level too low
    at RequestHandler.execute (/home/menitox/NeoClocker/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/menitox/NeoClocker/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
    at async ThreadManager.create (/home/menitox/NeoClocker/node_modules/discord.js/src/managers/ThreadManager.js:132:18) {
  method: 'post',
  path: '/channels/842526064827301909/messages/931311236006686851/threads',
  code: 20035,
  httpStatus: 400,
  requestData: {
    json: {
      name: 'Doubt of Pablo Contreras',
      auto_archive_duration: 10080,
      type: 11
    },
    files: []
  }
}

CodePudding user response:

The problem is that you try to set the autoArchiveDuration to 10080. Although you can set it to 60, 1440, 4320, or 10080,

  • 4320 is only available on level 1 (when the guild has the THREE_DAY_THREAD_ARCHIVE feature)
  • 10080 is only available on level 2 (when the guild has the SEVEN_DAY_THREAD_ARCHIVE feature)

If you set autoArchiveDuration to 60, 1440, or MAX, your code will work fine. MAX is based on your guild's features.

Another thing is if you provide the startMessage option, the type of thread gets automatically defined and cannot be changed. The provided type field will be ignored, so you don't need to add it. Its default value is GUILD_PUBLIC_THREAD.

let threadChannel: ThreadChannel = await message.channel.threads.create({
  name: `Doubt of ${nick}`,
  autoArchiveDuration: 'MAX',
  startMessage: message.id,
});

CodePudding user response:

I'm assuming you're trying to archive the thread after 7 days. However, you can only automatically archive up to 24 hours if the guild has not been boosted to level 1 at least.

  • Boost level 0 - 1 hour, 24 hours
  • Boost level 1 - 3 days
  • Boost level 2 - 7 days
  •  Tags:  
  • Related