logging: fix timeout showing when it shouldnt
This commit is contained in:
parent
b1b7d2d09d
commit
2b75ef0ec2
1 changed files with 10 additions and 10 deletions
|
@ -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: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue