13.1.2 debug bank related commands
This commit is contained in:
7 files changed
+16
-20
No files matched your search
+6
-10
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user