Home > Blockchain >  Entering to a Collection Discord.js v13
Entering to a Collection Discord.js v13

Time:11-20

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

CodePudding user response:

<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().

  • Related