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

144
Vistas
Why isn't the catch statement working for emoji reactions? | discord.js v13

So i'm trying to edit an embed when the user doesn't react with something like gameover you lost @user! only issue is, it's not editing at all and it's not even entering the catch statement it just keeps going into the then statement. I've done this method before and I'm currently using it for another command and works 100% correctly and I've just copied the code as is and still doesn't work and I don't understand why.

const testEmbed = new discord.MessageEmbed()
  .setColor('#FFFFFF')
  .setTitle("Test")
  .setDescription(`${message.author} was here!`)
  .addFields({
    name: `${message.author}`,
    value: `The name of the author`,
    inline: true
  }, {
    name: `${message.author.id}`,
    value: `The ID of the author`,
    inline: true
  })
  .setImage(`some link to some image`)

const reactEmbed = await message.channel.send({
  embeds: [testEmbed]
});
await reactEmbed.react("🤜");
await reactEmbed.react("🤛");

const filter = (reaction, user) => {
  return ["🤜", "🤛"].includes(reaction.emoji.name) && user.id === message.author.id;
}


reactEmbed.awaitReactions({
    filter,
    max: 1,
    time: 15000,
    error: ["time"]
  }).then(
    async(collected) => {
      const reaction = collected.first();
      console.log(`${reaction} i am in the then statement`);
    })
  .catch(async collected => {
    console.log(`${collected} im in the catch statement`)
    reactEmbed.reactions.removeAll();
    const reactEmbedEdited = new discord.MessageEmbed()
      .setTitle(`Gameover!`)
      .setColor('#000000')
      .addField('new Field', 'new Field')
    await reactEmbed.edit({
      embeds: [reactEmbedEdited]
    });
  })

The output expected would be for the original embed sent to be edited into the new embed if no one reacts. However, when i test this command by running it, it sends the original embed, reacts then waits 15 seconds and prints the first statement i am in the then statement which completely makes no sense judging that it works perfectly fine in my other command and comparing them both there is no difference between them. So my questions are:

  1. Why does it enter the then statement?
  2. Why won't it enter the catch statement?
  3. What is the issue with it and how can it be fixed?

I'm getting no errors just the console log output.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are missing an s in errors so:

reactEmbed.awaitReactions({
    filter,
    max: 1,
    time: 15000,
    errors: ["time"]
         ^
  }).then(...)
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