Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
discord.js - How to get specific collected message

I'm trying to get specific collected message, e.g. third collected message. The forEach works perfect, but I need just one specific, like I said previously.

collector.on('end', collected => {
    console.log(`Collected ${collected.size} messages`)

    message.channel.send(`${collected}`)

    collected.forEach(value => {
      message.channel.send(`${value}`)
    })
})
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

collected is a Collection, not an array. You can find the documentation here.

You could use the .at(index) method that returns the item at a given index. So in order to get the third item, you could use the following:

let thirdCollectedMessage = collected.at(2)
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda