Skip to content

Commit

Permalink
Fix parsing error for AutoModResponse (#2728)
Browse files Browse the repository at this point in the history
  • Loading branch information
StasiumDev authored Sep 21, 2024
1 parent 1c25f62 commit a7224c4
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a7224c4

Please sign in to comment.