From a7224c40a9c15402d2a904ddc16ca8f347691949 Mon Sep 17 00:00:00 2001 From: Stasium <41346624+StasiumDev@users.noreply.github.com> Date: Sat, 21 Sep 2024 13:04:43 +0200 Subject: [PATCH] Fix parsing error for AutoModResponse (#2728) --- .../jda/internal/entities/automod/AutoModResponseImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/automod/AutoModResponseImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/automod/AutoModResponseImpl.java index f15fd97c4d..a55d3709a3 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/automod/AutoModResponseImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/automod/AutoModResponseImpl.java @@ -66,10 +66,11 @@ public AutoModResponseImpl(Type type, Duration duration) public AutoModResponseImpl(Guild guild, DataObject json) { + DataObject metadata = json.optObject("metadata").orElseGet(DataObject::empty); this.type = AutoModResponse.Type.fromKey(json.getInt("type", -1)); - this.channel = guild.getChannelById(GuildMessageChannel.class, json.getUnsignedLong("channel_id", 0L)); - this.customMessage = json.getString("custom_message", null); - this.timeoutDuration = json.getUnsignedLong("duration_seconds", 0L); + this.channel = guild.getChannelById(GuildMessageChannel.class, metadata.getUnsignedLong("channel_id", 0L)); + this.customMessage = metadata.getString("custom_message", null); + this.timeoutDuration = metadata.getUnsignedLong("duration_seconds", 0L); } @Nonnull