Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Entering to a Collection Discord.js v13

I recently updated to v13, and I had some commands where i transform Objects to arrays using .array(), but now it gives my an error saying that .array() isn’t a function
How can I enter to the information in a Collection now?

msg.array()[0].embeds[0]

This is an example of what I used to do

TypeError: mensajes.array is not a function

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

<Collection>.array() has been removed in discord.js

If you need to convert a collection to an array of values similar to the old method, use Array.from(<Collection>.values())

But in your case, I don’t see a need to convert to an array in the first place.
If you want to get the first element in the collection, it would be much more efficient to use <Collection>.first().

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading