How can I check if an ID is a category?
How can I check if an ID is a category?
17 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.A category of the guilds your bot is in or...?
yes
<Client>.channels.cache.has("id")
It'll return boolean
then it pulls all channels I want to see if it is just category
That doesn't pull the channel, it just checks if a category with that id exists in the cache
TypeError: Cannot read properties of undefined (reading 'cache')
Show your code
I got it, it returned true, but it is not a category
is channel text
Oh, I get what you mean now, you'd first get the channel from the cache and then compare its type with ChannelType.GuildCategory
yes*
How do I get the channel?
The first one
yes
and to check the type?
is channel.type?
Yes
returned 0
:_:
Yes, you'd compare that with ChannelType.GuildCategory