aboutsummaryrefslogtreecommitdiff
path: root/handler/errors.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-01-07 18:04:44 +0100
committerMinteck <contact@minteck.org>2022-01-07 18:04:44 +0100
commitac2dea4a23ca72001e41c1dbf66ff1a0d01e217c (patch)
tree3cb37a7135bf5530917270ebde08f797ff52ea38 /handler/errors.js
parent041b8d1035cf0e7f6f8c686ec5dd7aa4ef204907 (diff)
downloadponyfind-ac2dea4a23ca72001e41c1dbf66ff1a0d01e217c.tar.gz
ponyfind-ac2dea4a23ca72001e41c1dbf66ff1a0d01e217c.tar.bz2
ponyfind-ac2dea4a23ca72001e41c1dbf66ff1a0d01e217c.zip
Update
Diffstat (limited to 'handler/errors.js')
-rwxr-xr-xhandler/errors.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/handler/errors.js b/handler/errors.js
new file mode 100755
index 0000000..1bae519
--- /dev/null
+++ b/handler/errors.js
@@ -0,0 +1,44 @@
+const fs = require('fs');
+const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js');
+
+module.exports = async (interaction, e) => {
+ try {
+ await interaction.reply({
+ ephemeral: false,
+ embeds: [
+ new MessageEmbed()
+ .setColor('#dc2828')
+ .setTitle(l("An internal exception occurred", "Une erreur interne s'est produite", interaction.user.id, interaction.guild.id))
+ .setDescription(l("That's not your fault! The developers have already been informed about the issue and will resolve it as soon as possible.", "Ce n'est pas votre faute ! Les développeurs ont déjà été informés du problème et il sera corrigé aussi vite que possible.", interaction.user.id, interaction.guild.id) + "\n\n```\n" + e.stack + "\n```")
+ ],
+ components: [
+ new MessageActionRow()
+ .addComponents(
+ new MessageButton()
+ .setCustomId("error.report")
+ .setLabel(l("Send bug report", "Envoyer un rapport de bug", interaction.user.id, interaction.guild.id))
+ .setStyle("DANGER")
+ )
+ ]
+ });
+ } catch (e) {
+ await interaction.reply({
+ ephemeral: false,
+ embeds: [
+ new MessageEmbed()
+ .setColor('#dc2828')
+ .setTitle("An internal exception occurred")
+ .setDescription("That's not your fault! The developers have already been informed about the issue and will resolve it as soon as possible.\n\n```\n" + e.stack + "\n```")
+ ],
+ components: [
+ new MessageActionRow()
+ .addComponents(
+ new MessageButton()
+ .setCustomId("error.report")
+ .setLabel("Send bug report")
+ .setStyle("DANGER")
+ )
+ ]
+ });
+ }
+} \ No newline at end of file