Skip to content

Does anyone know how to create and delete a category with channels in Discord.js?

I am trying to get my discord bot to create a category that has 3 distinct channels, each with different permissions. I would also like a way to delete this category entirely at the end of my code. Any idea on how to do it?


There are multiple ways to do it. Here are 3 of them:

Putting parent in channel create options:

guild.channels.create("chan-name", {
  parent: "123456789012345678" // the ID of the category channel

Using CategoryChannel#createChannel()


And lastly, not recommended though, is assigning after creation. It’s not recommended as it does 2 API requests rather than 1

let channel = await guild.channels.create("chan-name")