From 9fed504f375396e755c62aec634dfa2c27cc4d29 Mon Sep 17 00:00:00 2001 From: Noah Date: Tue, 23 Nov 2021 17:37:25 -0600 Subject: [PATCH] Fixed /close --- Commands/close.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Commands/close.js b/Commands/close.js index 12c4290..e836167 100644 --- a/Commands/close.js +++ b/Commands/close.js @@ -28,14 +28,17 @@ module.exports = new Command({ let TicketData = await JSON.parse( fs.readFileSync("./Data/TicketData.json", "utf8") ).tickets.find((t) => t.id === interaction.channel.id); - let tUser = interaction.client.users.cache.get(TicketData.user); - if (!interaction.channel.name.startsWith(`${supportbot.TicketPrefix}`)) { + if ( + !TicketData || + !interaction.channel.name.startsWith(`${supportbot.TicketPrefix}`) + ) { const Exists = new Discord.MessageEmbed() .setTitle("No Ticket Found!") .setDescription(`${supportbot.NoValidTicket}`) .setColor(supportbot.WarningColour); - return interaction.reply({ embed: Exists }); + return interaction.reply({ embeds: [Exists] }); } + let tUser = interaction.client.users.cache.get(TicketData.user); let transcriptChannel = await interaction.guild.channels.cache.find( (channel) => channel.name == supportbot.TranscriptLog ||