From 71d93eed7bca2f433fc67cffcf787d3cf8acae9b Mon Sep 17 00:00:00 2001 From: Adrian Paschkowski Date: Fri, 20 Oct 2023 19:20:39 +0200 Subject: [PATCH] Support Audit Log change key for timeouts --- .../javacord/api/entity/auditlog/AuditLogChangeType.java | 1 + .../javacord/core/entity/auditlog/AuditLogEntryImpl.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/javacord-api/src/main/java/org/javacord/api/entity/auditlog/AuditLogChangeType.java b/javacord-api/src/main/java/org/javacord/api/entity/auditlog/AuditLogChangeType.java index cd3386570a..327aaed1bb 100644 --- a/javacord-api/src/main/java/org/javacord/api/entity/auditlog/AuditLogChangeType.java +++ b/javacord-api/src/main/java/org/javacord/api/entity/auditlog/AuditLogChangeType.java @@ -83,6 +83,7 @@ public enum AuditLogChangeType implements Nameable { DEAF("deaf"), MUTE("mute"), NICK("nick"), + COMMUNICATION_DISABLED_UNTIL("communication_disabled_until"), // integration ENABLE_EMOTICONS("enable_emoticons"), diff --git a/javacord-core/src/main/java/org/javacord/core/entity/auditlog/AuditLogEntryImpl.java b/javacord-core/src/main/java/org/javacord/core/entity/auditlog/AuditLogEntryImpl.java index 150390fe66..d0d6ad1991 100644 --- a/javacord-core/src/main/java/org/javacord/core/entity/auditlog/AuditLogEntryImpl.java +++ b/javacord-core/src/main/java/org/javacord/core/entity/auditlog/AuditLogEntryImpl.java @@ -26,6 +26,7 @@ import java.awt.Color; import java.net.MalformedURLException; import java.net.URL; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -222,6 +223,13 @@ public AuditLogEntryImpl(AuditLog auditLog, JsonNode data) { change = new AuditLogChangeImpl<>(AuditLogChangeType.UNKNOWN, oldValue, newValue); } break; + case COMMUNICATION_DISABLED_UNTIL: + change = new AuditLogChangeImpl<>( + type, + oldValue != null ? OffsetDateTime.parse(oldValue.asText()).toInstant() : null, + newValue != null ? OffsetDateTime.parse(newValue.asText()).toInstant() : null + ); + break; case TYPE: // TODO Find a good way to both handle integers (channel type) and strings change = new AuditLogChangeImpl<>(type, oldValue, newValue);