This interaction Failed

im trying to go from 1 embed to two inside of a message and in the background im trying to change the opponent datavalue to the potoppvalue. but nothing is working. i even tried taking one of the embeds out and it didnt work. im using mongodb to manage data if thats important
if (interaction.customid === "fight") {
const { id } = interaction.user;
const profile = await profileModel.findOne({ userID: id });
const potoppValue = profile.potopp;
const opphp = profile.opphp;

await profileModel.findOneAndUpdate(
{ userID: id },
{ $set: { opp: potoppValue } },
{ new: true }
);

const opponantembed = new EmbedBuilder()
.setTitle(`Mob`)
.setDescription(`Opponent HP: `)
.setThumbnail($Var.mobs.mob1.image);

const playerembed = new EmbedBuilder()
.setTitle(`Player`)
.setDescription(`Your HP:`);

console.log(`fighting`);
await interaction.update({ embeds: [opponantembed, playerembed] });
}
if (interaction.customid === "fight") {
const { id } = interaction.user;
const profile = await profileModel.findOne({ userID: id });
const potoppValue = profile.potopp;
const opphp = profile.opphp;

await profileModel.findOneAndUpdate(
{ userID: id },
{ $set: { opp: potoppValue } },
{ new: true }
);

const opponantembed = new EmbedBuilder()
.setTitle(`Mob`)
.setDescription(`Opponent HP: `)
.setThumbnail($Var.mobs.mob1.image);

const playerembed = new EmbedBuilder()
.setTitle(`Player`)
.setDescription(`Your HP:`);

console.log(`fighting`);
await interaction.update({ embeds: [opponantembed, playerembed] });
}
3 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Bloonatics
Bloonatics4mo ago
if there's no error, try to add await interaction.deferUpdare() before doing any database operations and change interaction.update() to interaction.editReply() wait, it's. customId in line one, not customid
TOPRyuno
TOPRyuno4mo ago
... if that fixes it im gonna throw up i didnt even notice thank you.