© 2026 Hedgehog Software, LLC
async execute(interaction, profileData) { const { id } = interaction.user; const { tokens } = profileData; await interaction.deferReply(); const randomNum = Math.round(Math.random()); const result = randomNum ? "Heads" : "Tails"; const choice = interaction.options.getString("choice") const amount = interaction.options.getInteger("amount") if (amount >= tokens) { if(choice === result) { await profileModel.findOneAndUpdate( { userId: id }, { $inc: { tokens: amount * 2 } } ); await interaction.editReply(`Winner! You won ${amount*2} coins with **${choice}**`) } else { await interaction.editReply(`You lost! The coin landed on **${result}**`) } } else { await interaction.editReply(`You dont have enough Tokens!`) } },
Cannot access 'tokens' before initialization
const { tokens } = profileData;