From c2232d197b6922479e5ec7296bef358a7442a813 Mon Sep 17 00:00:00 2001 From: Philippe Dellaert Date: Sat, 27 Jan 2024 16:09:27 -0800 Subject: [PATCH] Checking if the channel exists earlier on --- src/events/logging/scamLogs.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/events/logging/scamLogs.ts b/src/events/logging/scamLogs.ts index 8f92bd21..a13a4255 100644 --- a/src/events/logging/scamLogs.ts +++ b/src/events/logging/scamLogs.ts @@ -40,16 +40,14 @@ const deleteFailed = makeEmbed({ }); export default event(Events.MessageCreate, async ({ log }, msg) => { - const conn = getConn(); - if (msg.guild === null) { // DM's return; } + const scamReportLogs = msg.guild.channels.resolve(constantsConfig.channels.SCAM_REPORT_LOGS) as TextChannel | null; if (scamReportLogs && msg.content.toLowerCase().includes('@everyone') && !msg.author.bot) { - const scamReportLogs = msg.guild.channels.resolve(constantsConfig.channels.SCAM_REPORT_LOGS) as TextChannel | null; - + const conn = getConn(); if (!conn && scamReportLogs) { await scamReportLogs.send({ embeds: [noConnEmbed] }); return;