logging: fix timeout showing when it shouldnt

This commit is contained in:
Cynthia Foxwell 2025-05-13 10:59:22 -06:00
parent b1b7d2d09d
commit 2b75ef0ec2
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -385,8 +385,6 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
const oldNickname = before?.nick; const oldNickname = before?.nick;
const newNickname = after?.nick; const newNickname = after?.nick;
const isTimedOut = after?.communication_disabled_until != undefined;
if (oldNickname != newNickname) { if (oldNickname != newNickname) {
fields.push({ fields.push({
name: "Nickname", name: "Nickname",
@ -395,15 +393,17 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
}); });
} }
const timeoutDuration = new Date( const isTimedOut = after?.communication_disabled_until != null;
isTimedOut ? after?.communication_disabled_until : before?.communication_disabled_until const timeout = isTimedOut ? after?.communication_disabled_until : before?.communication_disabled_until;
); if (timeout != null) {
const timeoutDuration = new Date(timeout);
fields.push({ fields.push({
name: isTimedOut ? "Timed out" : "Was timed out until", name: isTimedOut ? "Timed out" : "Was timed out until",
value: `<t:${Math.round(timeoutDuration.getTime() / 1000)}>`, value: `<t:${Math.round(timeoutDuration.getTime() / 1000)}>`,
inline: true, inline: true,
}); });
}
channel.createMessage({ channel.createMessage({
embeds: [ embeds: [