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•2y ago
Message Not Public
Sign In & Join Server To View
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
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 examplesChannelType is an enum imported from discord.js
You should not wrap it in a string
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ok i got it, thanks for the info<:love_Dva:1044602790703538266>