Checking a Category Channel for full?
I have a Category Channel hidden from members that I 'archive' channels into when they fall below a certain activity threshold. I've been bitten before because this category filled up and the move failed and threw an error.
I have since implemented it so it attempts the move -> catches the error -> checks the error to see if its related to the channel being full -> move channel to a different category.
My question is: Is it possible to somehow check the Category Channel for fullness before attempting to move so I can resolve the error before it happens? I don't see anything in the docs pertaining to checking for fullness
6 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!
- ✅
Marked as resolved by staffdiscord.js: 14.9.0
node: 16.19.1
Well, a category can hold 50 channels
So you can use conditions and compare
I think in the category object it would contain a property which is a map named channels, which you can get the size of the map and compare with 50
That works. I was hoping to make the logic a little more concrete (if they were to increase the max in the future the code won’t be future proofed) but that’s not a huge deal
Makes perfect sense. Thanks everyone!