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 }, {
|
||||
$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);
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
+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;
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user