问题
How to delete all channels in a specific category in Discord.JS? I tried that
oldMember.guild.channels.cache.get(client.tr["Settings"].MainChannelID).parent.channels.cache.forEach(c => {
if(c.members.size != 0){
c.delete();
}
})
回答1:
You can get all the channels that belong to a category using CategoryChannel.children
const category = await oldMember.guild.channels.cache.get(CATEGORY_ID); // You can use `find` instead of `get` to fetch the category using a name: `find(cat => cat.name === 'test')
category.children.forEach(channel => channel.delete())
来源:https://stackoverflow.com/questions/61826256/delete-all-channels-in-a-specific-category