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 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: `<t:${Math.round(timeoutDuration.getTime() / 1000)}>`,
inline: true,
});
fields.push({
name: isTimedOut ? "Timed out" : "Was timed out until",
value: `<t:${Math.round(timeoutDuration.getTime() / 1000)}>`,
inline: true,
});
}
channel.createMessage({
embeds: [