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

119
Vistas
How can I access collected reaction from awaitReactions?

This is my code and I want to access the collected emojis and send them back as a reply. I am also inserting the object I am getting from collected.

Here is the link for the object data: https://pastebin.com/MDm9dsvD

const emojis = [
  'booknquill',
  'balloon1',
  'rail',
  'Alex',
  'cookie1',
  'fish1',
  'Agent',
  'cake1',
  'pickaxe',
  'water',
  'Steve',
  'Apple',
  'carro1t',
  'panda',
  'sign',
  'potion',
  'map1',
  'llama1',
];

let msg = await message.channel.send('`What is your Code ?....`');

for (let i = 0; i < emojis.length; i++) {
  let reactionEmoji = message.guild.emojis.cache.find(
    (emoji) => emoji.name === emojis[i],
  );
  msg.react(reactionEmoji);
}

let reactedEmojis = [];

for (let i = 0; i < emojis.length; i++) {
  reactedEmojis.push(
    message.guild.emojis.cache.find((emoji) => emoji.name === emojis[i]),
  );
}

const filter = (reaction, user) => {
  return !user.bot;
};

msg
  .awaitReactions({ filter, max: 4, time: 60000, errors: ['time'] })
  .then((collected) => {
    console.log(collected.size);
    let userReaction = collected[0];
    console.log(collected[0]);
    message.channel.send(userReaction._emoji.name);
  });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

collected is a collection, not an array, so you can't simply access the first item using [0]. You can use methods like .first(), .last(), .at(), etc to access items.

To get the first collected item, you can use let userReaction = collected.first() or let userReaction = collected.at(0).

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