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')
+1 -1
View File
@@ -75,7 +75,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);
});
+3 -3
View File
@@ -211,9 +211,9 @@ module.exports = {
}
}
// Register inventory for user
// Register bank 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);
});
@@ -284,7 +284,7 @@ module.exports = {
// Register inventory for user
let newBank = new Bank();
newBank.createBank(invoice.from, GuildDB.serverID, GuildDB.startingBalance);
newBank.createBank(invoice.from, GuildDB.serverID, GuildDB.startingBalance, 0);
newBank.save().catch(err => {
if (err) return client.sendInternalError(interaction, err);
});
+2 -2
View File
@@ -94,7 +94,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);
});
@@ -106,7 +106,7 @@ module.exports = {
if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
}
const newBalance = args[0].name == 'add'
let newBalance = args[0].name == 'add'
? banking.guilds[GuildDB.serverID].account.balance + args[0].options[1].value
: banking.guilds[GuildDB.serverID].account.balance - args[0].options[1].value;
+1 -1
View File
@@ -90,7 +90,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);
});
+1 -1
View File
@@ -2,7 +2,7 @@ require('dotenv').config();
module.exports = {
Dev: "PROD.",
Version: "13.1.1", // (major).(feature).(revision/bug/refactoring)
Version: "13.1.2", // (major).(feature).(revision/bug/refactoring)
Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot
DefaultPrefix: "?",
ServerID: "955668596745461830",
+2 -2
View File
@@ -7,13 +7,13 @@ let bankSchema = mongoose.Schema({
}
});
bankSchema.methods.createBank = function (userID, guildID, startingBalance) {
bankSchema.methods.createBank = function (userID, guildID, startingBalance, cash) {
this.banking.userID = userID;
this.banking.guilds = {};
this.banking.guilds[guildID] = {
account: {
balance: startingBalance,
cash: 0.00,
cash: cash,
}
};;
};