From 2b75ef0ec25777a0621d645ced1fc6ec29e28028 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Tue, 13 May 2025 10:59:22 -0600 Subject: [PATCH] logging: fix timeout showing when it shouldnt --- src/modules/logging.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modules/logging.js b/src/modules/logging.js index 0c3d361..f5e8917 100644 --- a/src/modules/logging.js +++ b/src/modules/logging.js @@ -385,8 +385,6 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) { const oldNickname = before?.nick; const newNickname = after?.nick; - const isTimedOut = after?.communication_disabled_until != undefined; - if (oldNickname != newNickname) { fields.push({ name: "Nickname", @@ -395,15 +393,17 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) { }); } - const timeoutDuration = new Date( - isTimedOut ? after?.communication_disabled_until : before?.communication_disabled_until - ); + const isTimedOut = after?.communication_disabled_until != null; + const timeout = isTimedOut ? after?.communication_disabled_until : before?.communication_disabled_until; + if (timeout != null) { + const timeoutDuration = new Date(timeout); - fields.push({ - name: isTimedOut ? "Timed out" : "Was timed out until", - value: ``, - inline: true, - }); + fields.push({ + name: isTimedOut ? "Timed out" : "Was timed out until", + value: ``, + inline: true, + }); + } channel.createMessage({ embeds: [