0
votes
     var category = client.guilds.get('269811924399685634').channels.get('691715649625653450');
     var voice_channels = category.children.find(c => c.type == 'voice');

I'm set up this. I'm getting voice channels but i can't delete someone of voice channels in this category.

1

1 Answers

0
votes

Do you want to delete a channel you get? - Does the bot have permissions?

var voice_channels = category.children.find(c => c.type == 'voice');

- returns first voice channel

If you want to get every channel, use:

var voice_channels = category.children.filter(c => c.type == 'voice');

Deleting a channel: https://discord.js.org/#/docs/main/stable/class/Channel?scrollTo=delete

var voice_channels = category.children.filter(c => c.type == 'voice');
//Discord.js version 12 (I believe)
var channels = voice_channels.map(e => client.channels.resolve(e))
channels[1].delete()
//use client.channels.get(e) in older versions