diff --git a/commands/bank.js b/commands/bank.js index a2afcdd..4d6c343 100644 --- a/commands/bank.js +++ b/commands/bank.js @@ -156,8 +156,8 @@ module.exports = { client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, { $set: { - [`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance, - [`banking.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash + [`user.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance, + [`user.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash } }, function(err, res) { if (err) return client.sendInternalError(interaction, err); @@ -184,8 +184,8 @@ module.exports = { client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, { $set: { - [`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance, - [`banking.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash + [`user.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance, + [`user.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash } }, function(err, res) { if (err) return client.sendInternalError(interaction, err); @@ -228,7 +228,7 @@ module.exports = { if (err) return client.sendInternalError(interaction, err); }); - } else targetUserBanking = targetUserBanking.banking; + } else targetUserBanking = targetUserBanking.user; if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) { const success = addUser(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); @@ -270,7 +270,7 @@ module.exports = { client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, { $set: { - [`banking.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash + [`user.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash } }, function(err, res) { if (err) return client.sendInternalError(interaction, err); @@ -300,7 +300,7 @@ module.exports = { newBank.save().catch(err => { if (err) return client.sendInternalError(interaction, err); }); - } else targetUserBanking = targetUserBanking.banking; + } else targetUserBanking = targetUserBanking.user; if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) { const success = addUser(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance); @@ -327,7 +327,7 @@ module.exports = { const newBalance = banking.guilds[GuildDB.serverID].bankAccount.balance - args[0].options[1].value; - client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]:newBalance}}, function(err, res) { + client.dbo.collection("users").updateOne({"user.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}.bankAccount.balance`]:newBalance}}, function(err, res) { if (err) return client.sendInternalError(interaction, err); }); @@ -350,11 +350,11 @@ module.exports = { client.dbo.collection("users").insertOne(targetUserBanking, function(err, res) { if (err) return client.sendInternalError(interaction, err); }); - } else targetUserBanking = targetUserBanking.banking; + } else targetUserBanking = targetUserBanking.user; const newTargetBalance = targetUserBanking.guilds[GuildDB.serverID].bankAccount.balance + args[0].options[1].value; - client.dbo.collection("users").updateOne({"user.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]:newTargetBalance}}, function(err, res) { + client.dbo.collection("users").updateOne({"user.userID":targetUserID},{$set:{[`user.guilds.${GuildDB.serverID}.bankAccount.balance`]:newTargetBalance}}, function(err, res) { if (err) return client.sendInternalError(interaction, err); }); diff --git a/commands/bounty.js b/commands/bounty.js index 2a15072..6ed143f 100644 --- a/commands/bounty.js +++ b/commands/bounty.js @@ -92,7 +92,7 @@ module.exports = { client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, { $set: { - [`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance, + [`user.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance, } }, function(err, res) { if (err) return client.sendInternalError(interaction, err); diff --git a/commands/collect-income.js b/commands/collect-income.js index 8259e7a..9fd7969 100644 --- a/commands/collect-income.js +++ b/commands/collect-income.js @@ -90,7 +90,7 @@ module.exports = { newData.bankAccount.balance += totalIncome; newData.lastIncome = now; - client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}`]: newData}}, function(err, res) { + client.dbo.collection("banks").updateOne({"banking.userID":interaction.member.user.id},{$set:{[`user.guilds.${GuildDB.serverID}`]: newData}}, function(err, res) { if (err) return client.sendInternalError(interaction, err); }); diff --git a/commands/money.js b/commands/money.js index beb4da4..f7b52b7 100644 --- a/commands/money.js +++ b/commands/money.js @@ -110,7 +110,7 @@ module.exports = { ? banking.guilds[GuildDB.serverID].bankAccount.balance + args[0].options[0].value : banking.guilds[GuildDB.serverID].bankAccount.balance - args[0].options[0].value; - client.dbo.collection("users").updateOne({"user.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]:newBalance}}, function(err, res) { + client.dbo.collection("users").updateOne({"user.userID":targetUserID},{$set:{[`user.guilds.${GuildDB.serverID}.bankAccount.balance`]:newBalance}}, function(err, res) { if (err) return client.sendInternalError(interaction, err); }); diff --git a/package.json b/package.json index f5bff5a..0b20483 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dayz-armbands", - "version": "5.11.6", + "version": "5.11.7", "description": "A General Purpose Discord Bot for DayZ Servers.", "main": "index.js", "nodemonConfig": { diff --git a/structures/DayzArmbands.js b/structures/DayzArmbands.js index a3ac0d6..2a7815d 100644 --- a/structures/DayzArmbands.js +++ b/structures/DayzArmbands.js @@ -202,7 +202,7 @@ class DayzArmbands extends Client { await this.dbo.collection("users").updateOne({ "user.userID": killerStat.discordID }, { $set: { - [`banking.guilds.${guildId}.bankAccount.balance`]: newBalance, + [`user.guilds.${guildId}.bankAccount.balance`]: newBalance, } }, function(err, res) { if (err) return this.sendError(guild.connectionLogsChannel, err);