v12.7.8 clean internal error handling
This commit is contained in:
11 files changed
+154
-510
No files matched your search
+5
-27
@@ -76,43 +76,21 @@ module.exports = {
|
||||
// Register inventory for user
|
||||
let newBank = new Bank();
|
||||
newBank.createBank(targetUserID, GuildDB.serverID, GuildDB.startingBalance);
|
||||
newBank.save()
|
||||
.catch(err => {
|
||||
if (err) {
|
||||
client.error(err);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||
.setColor(client.config.Colors.Red)
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
});
|
||||
newBank.save().catch(err => {
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
|
||||
} else banking = banking.banking;
|
||||
|
||||
if (!client.exists(banking.guilds[GuildDB.serverID])) {
|
||||
const success = addBank(banking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
|
||||
if (!success) {
|
||||
client.error(err);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||
.setColor(client.config.Colors.Red)
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
if (!success) return client.sendInternalError('Failed to add bank');
|
||||
}
|
||||
|
||||
const newTargetBalance = banking.guilds[GuildDB.serverID].account.balance - args[0].options[1].value;
|
||||
|
||||
client.dbo.collection("banks").updateOne({"banking.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newTargetBalance}}, function(err, res) {
|
||||
if (err) {
|
||||
client.error(err);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||
.setColor(client.config.Colors.Red)
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
|
||||
Reference in new issue
Block a user