debug bank
This commit is contained in:
6 files changed
+15
-15
No files matched your search
+10
-10
@@ -156,8 +156,8 @@ module.exports = {
|
|||||||
|
|
||||||
client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, {
|
client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, {
|
||||||
$set: {
|
$set: {
|
||||||
[`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance,
|
[`user.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance,
|
||||||
[`banking.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash
|
[`user.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash
|
||||||
}
|
}
|
||||||
}, function(err, res) {
|
}, function(err, res) {
|
||||||
if (err) return client.sendInternalError(interaction, err);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
@@ -184,8 +184,8 @@ module.exports = {
|
|||||||
|
|
||||||
client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, {
|
client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, {
|
||||||
$set: {
|
$set: {
|
||||||
[`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance,
|
[`user.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance,
|
||||||
[`banking.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash
|
[`user.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash
|
||||||
}
|
}
|
||||||
}, function(err, res) {
|
}, function(err, res) {
|
||||||
if (err) return client.sendInternalError(interaction, err);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
@@ -228,7 +228,7 @@ module.exports = {
|
|||||||
if (err) return client.sendInternalError(interaction, err);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else targetUserBanking = targetUserBanking.banking;
|
} else targetUserBanking = targetUserBanking.user;
|
||||||
|
|
||||||
if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) {
|
if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) {
|
||||||
const success = addUser(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
|
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 }, {
|
client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, {
|
||||||
$set: {
|
$set: {
|
||||||
[`banking.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash
|
[`user.guilds.${GuildDB.serverID}.bankAccount.cash`]: newCash
|
||||||
}
|
}
|
||||||
}, function(err, res) {
|
}, function(err, res) {
|
||||||
if (err) return client.sendInternalError(interaction, err);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
@@ -300,7 +300,7 @@ module.exports = {
|
|||||||
newBank.save().catch(err => {
|
newBank.save().catch(err => {
|
||||||
if (err) return client.sendInternalError(interaction, err);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
});
|
});
|
||||||
} else targetUserBanking = targetUserBanking.banking;
|
} else targetUserBanking = targetUserBanking.user;
|
||||||
|
|
||||||
if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) {
|
if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) {
|
||||||
const success = addUser(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
|
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;
|
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);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -350,11 +350,11 @@ module.exports = {
|
|||||||
client.dbo.collection("users").insertOne(targetUserBanking, function(err, res) {
|
client.dbo.collection("users").insertOne(targetUserBanking, function(err, res) {
|
||||||
if (err) return client.sendInternalError(interaction, err);
|
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;
|
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);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ module.exports = {
|
|||||||
|
|
||||||
client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, {
|
client.dbo.collection("users").updateOne({ "user.userID": interaction.member.user.id }, {
|
||||||
$set: {
|
$set: {
|
||||||
[`banking.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance,
|
[`user.guilds.${GuildDB.serverID}.bankAccount.balance`]: newBalance,
|
||||||
}
|
}
|
||||||
}, function(err, res) {
|
}, function(err, res) {
|
||||||
if (err) return client.sendInternalError(interaction, err);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ module.exports = {
|
|||||||
newData.bankAccount.balance += totalIncome;
|
newData.bankAccount.balance += totalIncome;
|
||||||
newData.lastIncome = now;
|
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);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
: 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);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dayz-armbands",
|
"name": "dayz-armbands",
|
||||||
"version": "5.11.6",
|
"version": "5.11.7",
|
||||||
"description": "A General Purpose Discord Bot for DayZ Servers.",
|
"description": "A General Purpose Discord Bot for DayZ Servers.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ class DayzArmbands extends Client {
|
|||||||
|
|
||||||
await this.dbo.collection("users").updateOne({ "user.userID": killerStat.discordID }, {
|
await this.dbo.collection("users").updateOne({ "user.userID": killerStat.discordID }, {
|
||||||
$set: {
|
$set: {
|
||||||
[`banking.guilds.${guildId}.bankAccount.balance`]: newBalance,
|
[`user.guilds.${guildId}.bankAccount.balance`]: newBalance,
|
||||||
}
|
}
|
||||||
}, function(err, res) {
|
}, function(err, res) {
|
||||||
if (err) return this.sendError(guild.connectionLogsChannel, err);
|
if (err) return this.sendError(guild.connectionLogsChannel, err);
|
||||||
|
|||||||
Reference in new issue
Block a user