Problems with server statistics

Hi all. I'm a beginner bot developer on Discord. I have this question: I want to display the number of voice and text channels, the code works, but very badly. Shows 0. What should I do?
6 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Squid
Squid2y ago
What code are you using to count them? My guess is that you're using an outdated guide which compares properties that have changed throughout DJS versions, e.g. checking if channel.type === 'text' instead of channel.type === ChannelType.GuildText
Blackie
Blackie2y ago
I used like this: interaction.guild.channels.cache.filter((ch) => ch.type === "ChannelType.GuildText").size I just do not understand how to do it right, I looked at the examples
Squid
Squid2y ago
ChannelType is an enum imported from discord.js You should not wrap it in a string
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Blackie
Blackie2y ago
ok i got it, thanks for the info<:love_Dva:1044602790703538266>