Update close.js

This commit is contained in:
Noah committed 2021-11-23 18:09:06 -06:00
1 parent ffdce5820b
commit 1ee0d4a09e
1 file changed
+6 -4
+6 -4
View File
@@ -30,7 +30,7 @@ module.exports = new Command({
).tickets.find((t) => t.id === interaction.channel.id); ).tickets.find((t) => t.id === interaction.channel.id);
if ( if (
!TicketData || !TicketData ||
!interaction.channel.name.startsWith(`${supportbot.TicketPrefix}`) !interaction.channel.name.startsWith(supportbot.TicketPrefix)
) { ) {
const Exists = new Discord.MessageEmbed() const Exists = new Discord.MessageEmbed()
.setTitle("No Ticket Found!") .setTitle("No Ticket Found!")
@@ -50,7 +50,7 @@ module.exports = new Command({
channel.id == supportbot.TicketLog channel.id == supportbot.TicketLog
); );
let reason = let reason =
(await interaction.options.getString("reason")) || "No Reason Provided."; (await interaction.options?.getString("reason")) || "No Reason Provided.";
if (!transcriptChannel || !logChannel) if (!transcriptChannel || !logChannel)
return interaction.reply("Some Channels seem to be missing!"); return interaction.reply("Some Channels seem to be missing!");
@@ -132,12 +132,12 @@ module.exports = new Command({
await transcriptChannel await transcriptChannel
.send({ embeds: [transcriptEmbed], files: [file] }) .send({ embeds: [transcriptEmbed], files: [file] })
.catch(async (err) => { .catch(async (err) => {
await console.error(err); console.error(err);
}); });
await tUser await tUser
.send({ embeds: [transcriptEmbed], files: [file] }) .send({ embeds: [transcriptEmbed], files: [file] })
.catch(async (err) => { .catch(async (err) => {
await console.error(err); console.error(err);
}); });
await interaction.channel.delete().catch(async (error) => { await interaction.channel.delete().catch(async (error) => {
@@ -148,10 +148,12 @@ module.exports = new Command({
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
/*
await interaction.followUp({ await interaction.followUp({
content: "The request to close the ticket has timed out.", content: "The request to close the ticket has timed out.",
}); });
setTimeout(() => interaction.channel.delete(3000)); setTimeout(() => interaction.channel.delete(3000));
*/
} }
}, },
}); });