Trying to make a counter for text and voice channels. So it should exclude the amoount of categories.
module.exports = async (client) => {
const guild = client.guilds.cache.get('912706237806829598');
setInterval(async () => {
const channelCount = (await guild.channels.fetch()).filter(
(channel) => channel.type !== 'category'
).size;
const channel = guild.channels.cache.get('960790479925039124');
channel.setName(`╭・Channels: ${channelCount.toLocaleString()}`);
console.log('Updating Channel Count');
console.log(channelCount);
}, 600000);
};
This gives me 183 which is wrong. The number I want to achieve is 155. I have 28 categories, so 183 makes sense if the categories aren't filtered. Filtering the categories has been a bigger struggle that I anticipated.
I have also tried to filter on the cache. guild.channels.cache.filter(channel => channel.type !== 'category').size;
but it results in the same way (183). So the filtering isn't working as intended.