better error handling

This commit is contained in:
SowinskiBraeden committed 2022-08-27 20:14:21 -07:00
1 parent ea799693de
commit 28b73e3a8f
14 files changed
+160 -157

No files matched your search

+40 -40
View File
@@ -134,9 +134,9 @@ module.exports = {
newBank.save()
.catch(err => {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -148,9 +148,9 @@ module.exports = {
if (!client.exists(banking.guilds[GuildDB.serverID])) {
const success = addBank(banking.guilds, GuildDB.serverID, interaction.member.user.id, client, GuildDB.startingBalance);
if (!success) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -166,9 +166,9 @@ module.exports = {
newInventory.save()
.catch(err => {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -179,9 +179,9 @@ module.exports = {
if (!client.exists(inventory.guilds[GuildDB.serverID])) {
const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client);
if (!success) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -202,9 +202,9 @@ module.exports = {
client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance,[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -213,9 +213,9 @@ module.exports = {
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id, [`inventory.guilds.${GuildDB.serverID}.items.type`]:"wallet"},
{$set:{[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]:newCash}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -243,9 +243,9 @@ module.exports = {
client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance,[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -254,9 +254,9 @@ module.exports = {
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id, [`inventory.guilds.${GuildDB.serverID}.items.type`]:"wallet"},
{$set:{[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]:newCash}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -299,9 +299,9 @@ module.exports = {
newBank.save()
.catch(err => {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -313,9 +313,9 @@ module.exports = {
if (!client.exists(targetUserBanking.guilds[GuildDB.serverID])) {
const success = addBank(targetUserBanking.guilds, GuildDB.serverID, targetUserID, client, GuildDB.startingBalance);
if (!success) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -357,9 +357,9 @@ module.exports = {
client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.cash`]:newCash}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -369,9 +369,9 @@ module.exports = {
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id, [`inventory.guilds.${GuildDB.serverID}.items.type`]:"wallet"},
{$set:{[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]:newCash}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -389,9 +389,9 @@ module.exports = {
newInventory.save()
.catch(err => {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -402,9 +402,9 @@ module.exports = {
if (!client.exists(targetUserInventory.guilds[GuildDB.serverID])) {
const success = addInventory(targetUserInventory.guilds, GuildDB.serverID, targetUserID, client);
if (!success) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -415,9 +415,9 @@ module.exports = {
client.dbo.collection("inventories").updateOne({"inventory.userID":targetUserID, [`inventory.guilds.${GuildDB.serverID}.items.type`]:"wallet"},
{$set:{[`inventory.guilds.${GuildDB.serverID}.items.$.cash`]:newTargetCash}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -438,9 +438,9 @@ module.exports = {
client.dbo.collection("banks").insertOne(targetUserBanking, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -451,9 +451,9 @@ module.exports = {
client.dbo.collection("banks").updateOne({"account.userID": targetUserID}, {$set: {[`banking.guilds.${GuildDB.serverID}.account.cash`]: newTargetCash}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -483,9 +483,9 @@ module.exports = {
client.dbo.collection("banks").updateOne({"account.userID":interaction.member.user.id},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newBalance}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -506,9 +506,9 @@ module.exports = {
client.dbo.collection("banks").insertOne(targetUserBanking, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });
@@ -519,9 +519,9 @@ module.exports = {
client.dbo.collection("banks").updateOne({"account.userID":targetUserID},{$set:{[`banking.guilds.${GuildDB.serverID}.account.balance`]:newTargetBalance}}, function(err, res) {
if (err) {
client.log(err);
client.error(err);
const embed = new EmbedBuilder()
.setDescriptions(`**Internal Error:** ${err}\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.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] });