1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/*
* MIT License
*
* Copyright (c) 2022- Minteck
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
const fs = require('fs');
const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js');
module.exports = async (interaction, e) => {
if (e.name === "DiscordAPIError") {
return;
}
console.error(e);
tid = "./reports/Telemetry-Crash-" + (new Date().toISOString().replace(/[^a-zA-Z0-9]/gm, "-")) + ".txt";
fs.writeFileSync(tid, "-------------------------\nPonyfind Telemetry Report\n-------------------------\n\nReport Type:\n System Crash Report\n\n-------------------------\n\nReporter:\n " + interaction.user.tag + " (" + interaction.user.id + ")\n\nServer:\n " + (interaction.guild ? interaction.guild.name : "[Direct Messages]") + " (" + (interaction.guild ? interaction.guild.id : 0) + ")\n\nChannel:\n " + (interaction.channel ? interaction.channel.name : "[Direct Messages]") + " (" + (interaction.channel ? interaction.channel.id : 0) + ")\n\nItem:\n -\n\nReport Type:\n Automated Error Report\n\n-------------------------\n\n" + e.stack)
try {
await interaction.reply({
ephemeral: interaction.guild !== null,
embeds: [
new MessageEmbed()
.setColor('#dc2828')
.setTitle(l("An internal exception occurred", "Une erreur interne s'est produite", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
.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 ? interaction.guild.id : 0))
.setFooter({ text: "Ticket ID: " + tid })
]
});
} catch (e2) {
tid = "./reports/Telemetry-Crash-" + (new Date().toISOString().replace(/[^a-zA-Z0-9]/gm, "-")) + ".txt";
fs.writeFileSync(tid, "-------------------------\nPonyfind Telemetry Report\n-------------------------\n\nReport Type:\n System Crash Report\n\n-------------------------\n\nReporter:\n " + interaction.user.tag + " (" + interaction.user.id + ")\n\nServer:\n " + (interaction.guild ? interaction.guild.name : "[Direct Messages]") + " (" + (interaction.guild ? interaction.guild.id : 0) + ")\n\nChannel:\n " + (interaction.channel ? interaction.channel.name : "[Direct Messages]") + " (" + (interaction.channel ? interaction.channel.id : 0) + ")\n\nItem:\n -\n\nReport Type:\n Automated Error Report (chained with " + e.message + ")\n\n-------------------------\n\n" + e2.stack)
try {
await interaction.reply({
ephemeral: interaction.guild !== null,
embeds: [
new MessageEmbed()
.setColor('#dc2828')
.setTitle("2 internal exceptions occurred")
.setDescription("That's not your fault! The developers have already been informed about the issue and will resolve it as soon as possible. We additionally weren't able to deliver you a localized error message.")
.setFooter({ text: "Ticket ID: " + tid })
]
});
} catch (e3) {
tid = "./reports/Telemetry-Crash-" + (new Date().toISOString().replace(/[^a-zA-Z0-9]/gm, "-")) + ".txt";
fs.writeFileSync(tid, "-------------------------\nPonyfind Telemetry Report\n-------------------------\n\nReport Type:\n System Crash Report\n\n-------------------------\n\nReporter:\n " + interaction.user.tag + " (" + interaction.user.id + ")\n\nServer:\n " + (interaction.guild ? interaction.guild.name : "[Direct Messages]") + " (" + (interaction.guild ? interaction.guild.id : 0) + ")\n\nChannel:\n " + (interaction.channel ? interaction.channel.name : "[Direct Messages]") + " (" + (interaction.channel ? interaction.channel.id : 0) + ")\n\nItem:\n -\n\nReport Type:\n Automated Error Report (chained with " + e.message + " and " + e2.message + ")\n\n-------------------------\n\n" + e3.stack)
try {
interaction.channel.send({embeds: [new MessageEmbed()
.setColor('#dc2828')
.setTitle("3 internal exceptions occurred")
.setDescription("That's not your fault! The developers have already been informed about the issue and will resolve it as soon as possible. We additionally weren't able to deliver you a localized error message and/or through a reply to your command.")]
.setFooter({ text: "Ticket ID: " + tid })
}).catch((e4) => {
tid = "./reports/Telemetry-Crash-" + (new Date().toISOString().replace(/[^a-zA-Z0-9]/gm, "-")) + ".txt";
fs.writeFileSync(tid, "-------------------------\nPonyfind Telemetry Report\n-------------------------\n\nReport Type:\n System Crash Report\n\n-------------------------\n\nReporter:\n " + interaction.user.tag + " (" + interaction.user.id + ")\n\nServer:\n " + (interaction.guild ? interaction.guild.name : "[Direct Messages]") + " (" + (interaction.guild ? interaction.guild.id : 0) + ")\n\nChannel:\n " + (interaction.channel ? interaction.channel.name : "[Direct Messages]") + " (" + (interaction.channel ? interaction.channel.id : 0) + ")\n\nItem:\n -\n\nReport Type:\n Automated Error Report (chained with " + e.message + ", " + e2.message + " and " + e3.message + ")\n\n-------------------------\n\n" + e4.stack)
interaction.user.send({
embeds: [new MessageEmbed()
.setColor('#dc2828')
.setTitle("4 internal exceptions occurred")
.setDescription("That's not your fault! The developers have already been informed about the issue and will resolve it as soon as possible. We additionally weren't able to deliver you a localized error message, through a reply to your command and/or through the channel you initially executed the command.")]
.setFooter({ text: "Ticket ID: " + tid })
})
})
} catch (e) {}
}
}
}
|