diff --git a/src/modules/logging.js b/src/modules/logging.js index d02d546..5387e51 100644 --- a/src/modules/logging.js +++ b/src/modules/logging.js @@ -164,6 +164,13 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) { }); break; } + default: { + fields.push({ + name: `\`${key}\``, + value, + inline: true, + }); + } } } @@ -278,7 +285,7 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) { } default: { fields.push({ - name: key, + name: `\`${key}\``, value: formatChange(oldValue, newValue), inline: true, }); @@ -388,27 +395,43 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) { const bot = hf.bot; const target = bot.users.get(entry.targetID); - const oldNickname = before?.nick; - const newNickname = after?.nick; + for (const [key, newValue] of Object.entries(after)) { + const oldValue = before[key]; + switch (key) { + case "nick": { + if (oldValue != newValue) { + fields.push({ + name: "Nickname", + value: formatChange(oldValue, newValue), + inline: true, + }); + } + break; + } + case "communication_disabled_until": { + const isTimedOut = newValue != null; + const timeout = isTimedOut ? newValue : oldValue; + if (timeout != null) { + const timeoutDuration = new Date(timeout); - if (oldNickname != newNickname) { - fields.push({ - name: "Nickname", - value: formatChange(oldNickname, newNickname), - inline: true, - }); - } - - 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 until" : "Was timed out until", - value: ``, - inline: true, - }); + fields.push({ + name: isTimedOut ? "Timed out until" : "Was timed out until", + value: ``, + inline: true, + }); + } + break; + } + case "bypasses_verification": + break; + default: { + fields.push({ + name: `\`${key}\``, + value: formatChange(oldValue, newValue), + inline: true, + }); + } + } } let verb = "updated";