Fixed close + Send transcript to subusers

This commit is contained in:
Noah committed 2021-12-14 18:04:38 -06:00
1 parent 7760699155
commit 6107d268f7
4 files changed
+203 -257

No files matched your search

+6 -11
View File
@@ -29,10 +29,7 @@ module.exports = new Command({
let TicketData = await JSON.parse(
fs.readFileSync("./Data/TicketData.json", "utf8")
).tickets.find((t) => t.id === interaction.channel.id);
if (
!TicketData ||
!interaction.channel.name.startsWith(supportbot.TicketPrefix)
) {
if (!TicketData) {
const Exists = new Discord.MessageEmbed()
.setTitle("No Ticket Found!")
.setDescription(`${supportbot.NoValidTicket}`)
@@ -138,7 +135,11 @@ module.exports = new Command({
.catch(async (err) => {
console.error(err);
});
TicketData.subUsers.forEach(async (subUser) => {
interaction.client.users.cache
.get(subUser)
.send({ embeds: [transcriptEmbed], files: [file] });
});
await interaction.channel.delete().catch(async (error) => {
console.error(error);
if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) {
@@ -147,12 +148,6 @@ module.exports = new Command({
});
} catch (error) {
console.error(error);
/*
await interaction.followUp({
content: "The request to close the ticket has timed out.",
});
setTimeout(() => interaction.channel.delete(3000));
*/
}
},
});