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