13.1.2 debug bank related commands

This commit is contained in:
SowinskiBraeden committed 2022-10-25 11:54:56 -07:00
1 parent b90052542c
commit b1cf688fac
7 files changed
+16 -20

No files matched your search

+6 -10
View File
@@ -131,7 +131,7 @@ module.exports = {
// Register inventory for user
let newBank = new Bank();
newBank.createBank(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance);
newBank.createBank(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance, 0);
newBank.save().catch(err => {
if (err) return client.sendInternalError(interaction, err);
});
@@ -274,7 +274,7 @@ module.exports = {
// Register inventory for user
let newBank = new Bank();
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance);
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance, 0);
newBank.save().catch(err => {
if (err) return client.sendInternalError(interaction, err);
});
@@ -340,7 +340,7 @@ module.exports = {
let targetUserInventory = await client.dbo.collection("inventories").findOne({"inventory.userID":targetUserID}).then(inventory => inventory);
if (!targetUserInventory) {
targetUserBanking = {
targetUserInventory = {
userID: targetUserID,
guilds: {
[GuildDB.serverID]: {
@@ -374,7 +374,7 @@ module.exports = {
if (!success) return client.sendInternalError(interaction, 'Failed to add inventory');
}
const newTargetCash = targetUserInventory.inventory.guilds[GuildDB.serverID].items[0].cash + args[0].options[1].value;
let newTargetCash = targetUserInventory.guilds[GuildDB.serverID].items[0].cash + args[0].options[1].value;
client.dbo.collection("inventories").updateOne(
{
"inventory.userID": targetUserID,
@@ -397,7 +397,7 @@ module.exports = {
[GuildDB.serverID]: {
account: {
balance: GuildDB.startingBalance,
cash: 0.00,
cash: newTargetCash,
}
}
}
@@ -405,7 +405,7 @@ module.exports = {
// Register inventory for user
let newBank = new Bank();
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance);
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance, newTargetCash);
newBank.save().catch(err => {
if (err) return client.sendInternalError(interaction, err);
});
@@ -415,10 +415,6 @@ module.exports = {
const success = addBank(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
}
client.dbo.collection("banks").updateOne({"banking.userID": targetUserID}, {$set: {[`banking.guilds.${GuildDB.serverID}.account.cash`]: newTargetCash}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});
const successEmbed = new EmbedBuilder()
.setTitle('Success')