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 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: [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue