Unified error handling
This commit is contained in:
parent
4846a36e55
commit
d12bb7f63a
4
main.js
4
main.js
@ -73,11 +73,11 @@ client.on('interactionCreate', async interaction => {
|
|||||||
break;
|
break;
|
||||||
case 'waterpingrole':
|
case 'waterpingrole':
|
||||||
const waterPingStatus = await fn.buttonHandlers.waterPing(interaction);
|
const waterPingStatus = await fn.buttonHandlers.waterPing(interaction);
|
||||||
await interaction.reply(waterPingStatus).catch(err => console.error(err));
|
await interaction.reply(waterPingStatus).catch(e => console.error(e));
|
||||||
break;
|
break;
|
||||||
case 'fruitpingrole':
|
case 'fruitpingrole':
|
||||||
const fruitPingStatus = await fn.buttonHandlers.fruitPing(interaction);
|
const fruitPingStatus = await fn.buttonHandlers.fruitPing(interaction);
|
||||||
await interaction.reply(fruitPingStatus).catch(err => console.error(err));
|
await interaction.reply(fruitPingStatus).catch(e => console.error(e));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -23,7 +23,7 @@ module.exports = {
|
|||||||
const comparedRankings = await fn.rankings.compare(interaction, guildInfo);
|
const comparedRankings = await fn.rankings.compare(interaction, guildInfo);
|
||||||
|
|
||||||
const embed = fn.builders.comparisonEmbed(comparedRankings, guildInfo);
|
const embed = fn.builders.comparisonEmbed(comparedRankings, guildInfo);
|
||||||
await interaction.editReply(embed).catch(err => console.error(err));
|
await interaction.editReply(embed).catch(e => console.error(e));
|
||||||
} else {
|
} else {
|
||||||
await interaction.editReply(fn.builders.errorEmbed(findMessagesResponse.status));
|
await interaction.editReply(fn.builders.errorEmbed(findMessagesResponse.status));
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ module.exports = {
|
|||||||
// Build the string that shows the comparison // TODO Move the string building section to fn.builders?
|
// Build the string that shows the comparison // TODO Move the string building section to fn.builders?
|
||||||
const comparedRankings = await fn.rankings.compare(interaction, guildInfo);
|
const comparedRankings = await fn.rankings.compare(interaction, guildInfo);
|
||||||
const embed = fn.builders.comparisonEmbed(comparedRankings, guildInfo);
|
const embed = fn.builders.comparisonEmbed(comparedRankings, guildInfo);
|
||||||
await interaction.editReply(embed).catch(err => console.error(err));
|
await interaction.editReply(embed).catch(e => console.error(e));
|
||||||
} else {
|
} else {
|
||||||
await interaction.editReply(fn.builders.errorEmbed(findMessagesResponse.status));
|
await interaction.editReply(fn.builders.errorEmbed(findMessagesResponse.status));
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ module.exports = {
|
|||||||
.setDescription('View information about how the bot is set up in your server')
|
.setDescription('View information about how the bot is set up in your server')
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true }).catch(err => console.error(err));
|
await interaction.deferReply({ ephemeral: true }).catch(e => console.error(e));
|
||||||
try {
|
try {
|
||||||
if (interaction.client.guildInfos.has(interaction.guildId)) {
|
if (interaction.client.guildInfos.has(interaction.guildId)) {
|
||||||
let guildInfo = interaction.client.guildInfos.get(interaction.guildId);
|
let guildInfo = interaction.client.guildInfos.get(interaction.guildId);
|
||||||
|
Loading…
Reference in New Issue
Block a user