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

Solution 1:

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()

category.createChannel("chan-name")

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")
channel.setParent("category-id")