Obtaining Guild Name Doesn't Seem To Work v13.4.
Hi, I have returned to a year old bot and it seems that a function about getting and listing all guilds isn't detecting any guilds attached. When checked about length it is equal to 0.
The function in question:
3 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!Pretty sure Map.values() returns an Iterator, not an Array
You should just do
for (const guild of client.guilds.cache.values()) {…}
Better yet, just map and join the Collection
Are you sure the bot is in a guild?
The only other way it’s empty is if you have cache settings that prevents guilds from being cached or you clear the cache yourselfThe bot is in 3 guilds.
After applying this, it works fine. Thank you. :pepoHeart: