2021-05-31

Access the second item in Collection [Map]

I'm making a discord bot, and fetching some messages. I got this object

//This parameters changue every time i fetch
Collection(3) [Map] {
  '848689862764789770' => Message {...
  }
  '848689552410804234' => Message {...
  }
  '848689534485004319' => Message {...
  }

I can access the first and third entry using .first() and .last().

I've been trying to use Object.keys() but it returns undefined.

const mensajes = await message.channel.messages.fetch({ limit: 3 });
                
console.log(mensajes[Object.keys(mensajes)[1]])


from Recent Questions - Stack Overflow https://ift.tt/34xbGCg
https://ift.tt/eA8V8J

No comments:

Post a Comment