client.guilds.cache.array()

I am converting my old bot from discord.js v12 to v14. In v12, there was a function client.guilds.cache.array() which does not work in v14. What are the alternative(s) for v14?
5 Replies
d.js docs
d.js docs2y ago
• 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.
souji
souji2y ago
why do you need it to be an array in the first place? in 9/10 cases using and iterating the collection itself is preferred
Daniel H.
Daniel H.2y ago
I can do collection.forEach?
d.js docs
d.js docs2y ago
Converting a Collection to an array You only need to convert it to an array if you need the index of an entry: • Iteration (looping) is possible with for...of over Collection#values or forEach • You can transform a Collection to an array with Collection#map • If you need indices, you can get the array using [...collection.values()]
Daniel H.
Daniel H.2y ago
so I just do client.guilds.cache? Oh my bad then Sorry