Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda