DiscordAPIError[10062]: Unknown interaction

async function handleReaction(client, interaction, challenger, opponent, embed, logs) {
    try {
        const collectorFilter = (reaction, user) => ['šŸ‘', 'šŸ‘Ž'].includes(reaction.emoji.name) && user.id === opponent.user.id;
        const reactionCollector = await embed.awaitReactions({ filter: collectorFilter, max: 1, time: 5000, errors: ['time'] });
        const reaction = reactionCollector.first();

        if (reaction.emoji.name === 'šŸ‘') {
            embed.setFooter({ text: `Challenge #${client.challengeID}` });
            embed.setTimestamp();
            await challengeEmbed.edit({ embeds: [embed] });
        } else if (reaction.emoji.name === 'šŸ‘Ž') {
            await embed.delete({ timeout: 1000 });
            await logs.channel.send(`<@${challenger.id}> ${opponent.user.username} rejected your challenge`);
        }    
    } catch (error) {
        console.log(interaction);
        await interaction.reply("no time left");
        throw new Error(error);
    }
}

async execute(client, interaction) {
  const challenger = interaction.member.user
  const opponent = interaction.options.get("opponent")
  try {
    const match = await createMatchRequest(interaction, challenger, opponent)
    await handleReaction(client, interaction, challenger, opponent, match.embed, match.logs)
  } catch (error) {
    console.log(error)
  }
}

  • When I wait longer than the reaction time for awaitReactions to reach the catch block of handleReaction
  • The interaction object is not deferred and replied is false
  • When trying to reply to the interaction inside of the catch block, I get the discord api error: DiscordAPIError[10062]: Unknown interaction
Can someone explain why this error is thrown?
Was this page helpful?