TOPRYUNO
TOPRYUNO
DIAdiscord.js - Imagine an app
Created by TOPRYUNO on 2/21/2024 in #djs-questions
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] });
}
9 replies
DIAdiscord.js - Imagine an app
Created by TOPRYUNO on 2/20/2024 in #djs-questions
Button Interactions
No description
7 replies