Create a new category
Is there anyway I can, instead of using a set category id, make the bot look for a category with the name "Groups" if found it puts the new channels inside of they, else it creates a new category named "Groups"
7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!node: v20.11.0
discord.js: 14.15.3
:method: Collection#find
@2.1.0
Searches for a single item where the given function returns a truthy value. This behaves like Array.find(). All collections used in Discord.js are mapped using their id property, and if you want to find by id you should use the get method. See MDN for details.
Use that on the channel cache
Thank you so much! How would I create a category if I can't find one?
Call
<Guild>.channels.create(...)
and include type: ChannelType.GuildCategory
ty!