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
|
/*
* 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) => {
keys = interaction.values[0].split("|")
console.log(interaction.user.tag + " (" + interaction.user.id + ") selected menu item " + keys[0]);
if (statsMenu[keys[0]] !== undefined) {
statsMenu[keys[0]]++;
} else {
statsMenu[keys[0]] = 1;
}
fs.writeFile("./stats/menu.json", JSON.stringify(statsMenu), () => {});
if (keys[0].startsWith("report.issue.")) {
item = keys[0].substring(13)
tid = "./reports/Telemetry-Pony-" + (new Date().toISOString().replace(/[^a-zA-Z0-9]/gm, "-")) + ".txt";
fs.writeFileSync(tid, "-------------------------\nPonyfind Telemetry Report\n-------------------------\n\nReport Type:\n Pony Issue 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 " + keys[1] + "\n\nReport Type:\n " + item)
await interaction.reply({
ephemeral: interaction.guild !== null,
embeds: [
new MessageEmbed()
.setColor('#28dc46')
.setTitle(l("Thanks for reporting an issue with", "Merci d'avoir signalé un problème avec", interaction.user.id, interaction.guild ? interaction.guild.id : 0) + " \"" + keys[1] + "\"" + l("!", " !", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
.setDescription(l("Your report has been sent to the developers. They can contact you later if your settings allow this to ask you more about your issue.\nThanks for your help!", "Votre rapport a bien été envoyé aux développeurs. Ils pourront vous recontacter si vos paramètres le permettent afin de vous poser plus de questions sur le problème que vous rencontrez.\nMerci d'aider à améliorer notre système !", interaction.user.id, interaction.guild ? interaction.guild.id : 0))
.setFooter({ text: "Ticket ID: " + tid })
]
});
} else {
throw new Error("Unknown Menu ID");
}
}
|