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:
I'm getting no errors just the console log output.
You are missing an s in errors so:
reactEmbed.awaitReactions({
filter,
max: 1,
time: 15000,
errors: ["time"]
^
}).then(...)