From 95ec4c5f1e285e58a112833a3efd5b4a8b28013d Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Mon, 6 Nov 2023 17:58:28 -0800 Subject: [PATCH] fix/bounties length --- commands/bounty.js | 5 ++--- database/player.js | 1 + package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/bounty.js b/commands/bounty.js index f9223b2..0f9af49 100644 --- a/commands/bounty.js +++ b/commands/bounty.js @@ -104,7 +104,7 @@ module.exports = { setBy: (anonymous && !anonymous.value) ? interaction.member.user.id : null, value: args[0].options[1].value, }); - playerStat.bountiesLength++; + playerStat.bountiesLength = playerStat.bounties.length; // Will ensure bounties length = # of bounties, even if bountiesLength does not exists in player stat. await UpdatePlayer(client, playerStat, interaction); @@ -160,10 +160,9 @@ module.exports = { } else if (args[0].name == 'view') { - // TODO: only get players with boutnies.length greater than 0 const activeBounties = await client.dbo.collection("players").find({ "bountiesLength": { $gt: 0 } - }); + }).toArray(); let bountiesEmbed = new EmbedBuilder() .setColor(client.config.Colors.Default) diff --git a/database/player.js b/database/player.js index 0555aa8..cdd6f33 100644 --- a/database/player.js +++ b/database/player.js @@ -91,6 +91,7 @@ module.exports = { // Other bounties: [], + bountiesLength: 0, } }, diff --git a/package.json b/package.json index 3080711..4194c8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dayzr-bot", - "version": "12.3.7", + "version": "12.3.8", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "main": "index.js", "nodemonConfig": {