Skip to content
Advertisement

Get channels of category discord v14

i’m trying to get all channels and delete these channels of category in discord v14, but throw me an error:

client.channels.cache.get(…).children.forEach is not a function

JavaScript

Advertisement

Answer

CategoryChannel.children is type CategoryChannelChildManager, which doesn’t have a forEach method, so you can’t call forEach on it. CategoryChannelChildManager.cache is type Collection<Snowflake, GuildChannel>, which does has a forEach method, so you can call forEach on it.

JavaScript
Advertisement