Skip to content

Commit

Permalink
fix: fight now increasing wins
Browse files Browse the repository at this point in the history
  • Loading branch information
falcao-g committed Jun 4, 2024
1 parent afb5e50 commit c8e9fa4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/commands/economy/fight.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ module.exports = {
return;
}
if (author.falcoins >= bet && challengedFile.falcoins >= bet) {
author.falcoins -= bet;
author.save();
var answer = await instance.editReply(interaction, {
content: instance.getMessage(interaction, 'FIGHT_CHALLENGE', {
USER: member,
Expand Down Expand Up @@ -95,16 +97,20 @@ module.exports = {
}),
components: [],
});
author.falcoins += bet;
author.save();
} else if (collected.first().customId === 'refuse') {
interaction.editReply({
content: instance.getMessage(interaction, 'FIGHT_DECLINED', {
USER: collected.first().user,
}),
components: [],
});
author.falcoins += bet;
author.save();
} else {
author.falcoins -= bet;
challengedFile.falcoins -= bet;
challengedFile.save();
const attacks = [
['base', 25],
['stun', 15],
Expand Down Expand Up @@ -224,6 +230,7 @@ module.exports = {
const winnerFile = await database.player.findOne(winner.id);
winnerFile.falcoins += bet * 2;
winnerFile.wins++;
winnerFile.save();

const embed2 = instance.createEmbed(3066993).addFields(
{
Expand All @@ -250,8 +257,6 @@ module.exports = {
content: instance.getMessage(interaction, 'INSUFFICIENT_ACCOUNTS'),
});
}
author.save();
challengedFile.save();
} catch (error) {
console.error(`fight: ${error}`);
interaction.channel
Expand Down

0 comments on commit c8e9fa4

Please sign in to comment.