From 22b15d7fd7e4e67cb599c370eb7b7bf14f3569c0 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 24 May 2023 20:50:10 +0100 Subject: [PATCH] refactor: ticket logs --- src/lib/logging.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/logging.js b/src/lib/logging.js index 61463d1..5b24f86 100644 --- a/src/lib/logging.js +++ b/src/lib/logging.js @@ -138,6 +138,8 @@ async function logTicketEvent(client, { const member = await guild.members.fetch(userId); client.log.info.tickets(`${member.user.tag} ${client.i18n.getMessage('en-GB', `log.ticket.verb.${action}`)} ticket ${target.id}`); if (!ticket.guild.logChannel) return; + const channel = client.channels.cache.get(ticket.guild.logChannel); + if (!channel) return; const colour = action === 'create' ? 'Aqua' : action === 'close' ? 'DarkAqua' : action === 'update' @@ -149,8 +151,6 @@ async function logTicketEvent(client, { user: `<@${member.user.id}>`, verb: getMessage(`log.ticket.verb.${action}`), }; - const channel = client.channels.cache.get(ticket.guild.logChannel); - if (!channel) return; const embeds = [ new EmbedBuilder() .setColor(colour) @@ -238,4 +238,4 @@ module.exports = { logAdminEvent, logMessageEvent, logTicketEvent, -}; \ No newline at end of file +};