12.7.8 clean internal error handling
This commit is contained in:
1 file changed
+17
-130
+17
-130
@@ -130,14 +130,7 @@ module.exports = async (client, interaction) => {
|
||||
let item = inventory.guilds[GuildDB.serverID].items[args[0].options[0].value-1];
|
||||
|
||||
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
|
||||
let message = new EmbedBuilder()
|
||||
.setTitle(`You ${dropActions[Math.floor(Math.random() * dropActions.length)]} your ${item.name}`)
|
||||
@@ -168,16 +161,8 @@ module.exports = async (client, interaction) => {
|
||||
let newInventory = new Inventory();
|
||||
newInventory.createInventory(targetUserID, GuildDB.serverID);
|
||||
newInventory.addItem(item);
|
||||
newInventory.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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
newInventory.save().catch(err => {
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else {
|
||||
targetUserInventory = targetUserIventory.inventory;
|
||||
@@ -194,24 +179,10 @@ module.exports = async (client, interaction) => {
|
||||
}
|
||||
|
||||
client.dbo.collection('inventories').updateOne({'inventory.userID': interaction.member.user.id}, {$pull: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
client.dbo.collection('inventories').updateOne({'inventory.userID': targetUserID}, {$push: {[`inventory.guilds.${GuildDB.serverID}.items`]: item}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -237,14 +208,7 @@ module.exports = async (client, interaction) => {
|
||||
action = 'cleared';
|
||||
const tempWallet = inventory.guilds[GuildDB.serverID].items[0];
|
||||
client.dbo.collection("inventories").updateOne({"inventory.userID":interaction.member.user.id},{$set:{[`inventory.guilds.${GuildDB.serverID}.items`]: [tempWallet]}},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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (queryString==`inventoryClear-no-${interaction.member.user.id}`) action = 'kept';
|
||||
|
||||
@@ -330,14 +294,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull:{"server.allowedChannels": channelid}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -360,14 +317,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.actionChannel": null}},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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (queryString==`no-${interaction.member.user.id}`) action = 'kept';
|
||||
|
||||
@@ -390,14 +340,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.tweetChannel": null}},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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -420,14 +363,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.advertsChannel": null}},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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -450,14 +386,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatchChannel": null}},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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -480,14 +409,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": roleId}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -510,14 +432,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.commercialRole": null}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -540,14 +455,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='no') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.officerRole": null}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -570,14 +478,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.dispatcherRole": null}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -600,14 +501,7 @@ module.exports = async (client, interaction) => {
|
||||
if (interaction.customId.split('-')[1]=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.botAdmin": null}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -645,14 +539,7 @@ module.exports = async (client, interaction) => {
|
||||
onlyOfficersSearch: false,
|
||||
}
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server": defaultGuildConfig}}, 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.update({ embeds: [embed], components: [] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
|
||||
Reference in new issue
Block a user