'Discord.js V13: How do I get/ find a category?
I want to find a category just like how you find a channel.
let channel = message.guild.channels.cache.get(<id>);
Is there a way to find a category like this? I am trying to see if a specific category exists, and if it does not, it will create a category. I also want to find the category with a name and not an id.
Solution 1:[1]
It same with channels because categories are type of channel.
message.guild.channels.cache.find(channel => channel.type == "GUILD_CATEGORY" && channel.name == "xxx")
// this returns you category with this name if exists.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Neenhila |