12.8.3 fix internal error handling
This commit is contained in:
12 files changed
+211
-74
No files matched your search
+25
-25
@@ -395,7 +395,7 @@ module.exports = {
|
||||
if (error) return interaction.send({ embeds: [errorEmbed] });
|
||||
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push:{"server.allowedChannels": channelid}}, function (err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -442,7 +442,7 @@ module.exports = {
|
||||
|
||||
if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] });
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.actionChannel":channelid}},function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -481,7 +481,7 @@ module.exports = {
|
||||
|
||||
if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] });
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.tweetChannel":channelid}},function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -520,7 +520,7 @@ module.exports = {
|
||||
|
||||
if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] });
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.advertsChannel":channelid}},function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -560,7 +560,7 @@ module.exports = {
|
||||
|
||||
if (channelSetting == channelid) return interaction.send({ embeds: [presetEmbed] });
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.dispatchChannel":channelid}},function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -590,7 +590,7 @@ module.exports = {
|
||||
|
||||
} else if (args[0].name == 'starting_balance') {
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.startingBalance":args[0].options[0].value}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
let successEmbed = new EmbedBuilder()
|
||||
@@ -619,7 +619,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push: {"server.incomeRoles":newIncome}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else {
|
||||
client.dbo.collection("guilds").updateOne({
|
||||
@@ -631,7 +631,7 @@ module.exports = {
|
||||
"server.incomeRoles.$.income": args[0].options[0].options[1].value
|
||||
}
|
||||
}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
}
|
||||
const perform = searchIndex == -1 ? 'set' : 'updated';
|
||||
@@ -676,7 +676,7 @@ module.exports = {
|
||||
const roleId = args[0].options[0].options[0].value;
|
||||
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.commercialRole": roleId}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -711,7 +711,7 @@ module.exports = {
|
||||
if (args[0].options[0].name== 'set') {
|
||||
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.officerRole": roleId}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -746,7 +746,7 @@ module.exports = {
|
||||
const roleId = args[0].options[0].options[0].value;
|
||||
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.dispatcherRole": roleId}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -782,7 +782,7 @@ module.exports = {
|
||||
const roleId = args[0].options[0].options[0].value;
|
||||
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.botAdmin": roleId}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -814,7 +814,7 @@ module.exports = {
|
||||
} else if (args[0].name == 'only_officers_search') {
|
||||
const setting = args[0].options[0];
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.onlyOfficersSearch": setting}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const title = setting ? 'True: Only officers can use /search' : 'False: Any user can use /search';
|
||||
@@ -826,7 +826,7 @@ module.exports = {
|
||||
return interaction.send({ embeds: [successEmbed] });
|
||||
} else if (args[0].name == 'casino_multiplier') {
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.casinoMultiplier": args[0].options[0]}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
|
||||
const successEmbed = new EmbedBuilder()
|
||||
@@ -917,7 +917,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -941,7 +941,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (queryString==`no-${interaction.member.user.id}`) action = 'kept';
|
||||
|
||||
@@ -965,7 +965,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -989,7 +989,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -1013,7 +1013,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -1037,7 +1037,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -1061,7 +1061,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -1085,7 +1085,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -1109,7 +1109,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -1133,7 +1133,7 @@ module.exports = {
|
||||
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) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
@@ -1172,7 +1172,7 @@ module.exports = {
|
||||
onlyOfficersSearch: false,
|
||||
}
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server": defaultGuildConfig}}, function(err, res) {
|
||||
if (err) return client.sendInternalError(err);
|
||||
if (err) return client.sendInternalError(interaction, err);
|
||||
});
|
||||
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||
|
||||
|
||||
Reference in new issue
Block a user