删除特定类别中的所有频道

时间:2020-05-15 18:44:08

标签: javascript node.js discord discord.js

如何在Discord.JS中删除特定类别中的所有频道? 我尝试过

oldMember.guild.channels.cache.get(client.tr["Settings"].MainChannelID).parent.channels.cache.forEach(c => {
        if(c.members.size != 0){
            c.delete();
        }
    })

1 个答案:

答案 0 :(得分:1)

您可以使用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())