From 497f8757a735b9557ae5d113d1a8ef880db06d82 Mon Sep 17 00:00:00 2001 From: Axel Joly Date: Sat, 19 Oct 2024 14:50:00 +0200 Subject: [PATCH] wip: add soundboard support --- .../json/GuildSoundboardSoundsUpdateData.java | 42 ++++++++++++++ .../json/SoundboardSoundObject.java | 57 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 src/main/java/discord4j/discordjson/json/GuildSoundboardSoundsUpdateData.java create mode 100644 src/main/java/discord4j/discordjson/json/SoundboardSoundObject.java diff --git a/src/main/java/discord4j/discordjson/json/GuildSoundboardSoundsUpdateData.java b/src/main/java/discord4j/discordjson/json/GuildSoundboardSoundsUpdateData.java new file mode 100644 index 00000000..409faaee --- /dev/null +++ b/src/main/java/discord4j/discordjson/json/GuildSoundboardSoundsUpdateData.java @@ -0,0 +1,42 @@ +/* + * This file is part of Discord4J. + * + * Discord4J is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Discord4J is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Discord4J. If not, see . + */ +package discord4j.discordjson.json; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import discord4j.discordjson.Id; +import org.immutables.value.Value; + +import java.util.List; + +@Value.Immutable +@JsonSerialize(as = ImmutableGuildSoundboardSoundsUpdateData.class) +@JsonDeserialize(as = ImmutableGuildSoundboardSoundsUpdateData.class) +public interface GuildSoundboardSoundsUpdateData { + + static ImmutableGuildSoundboardSoundsUpdateData.Builder builder() { + return ImmutableGuildSoundboardSoundsUpdateData.builder(); + } + + @JsonProperty("soundboard_sounds") + List soundboardSounds(); + + @JsonProperty("guild_id") + Id guildId(); + +} diff --git a/src/main/java/discord4j/discordjson/json/SoundboardSoundObject.java b/src/main/java/discord4j/discordjson/json/SoundboardSoundObject.java new file mode 100644 index 00000000..1a0cea04 --- /dev/null +++ b/src/main/java/discord4j/discordjson/json/SoundboardSoundObject.java @@ -0,0 +1,57 @@ +/* + * This file is part of Discord4J. + * + * Discord4J is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Discord4J is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Discord4J. If not, see . + */ +package discord4j.discordjson.json; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import discord4j.discordjson.Id; +import discord4j.discordjson.possible.Possible; +import org.immutables.value.Value; + +import java.util.Optional; + +@Value.Immutable +@JsonSerialize(as = ImmutableSoundboardSoundObject.class) +@JsonDeserialize(as = ImmutableSoundboardSoundObject.class) +public interface SoundboardSoundObject { + + static ImmutableSoundboardSoundObject.Builder builder() { + return ImmutableSoundboardSoundObject.builder(); + } + + String name(); + + @JsonProperty("sound_id") + Id soundId(); + + double volume(); + + @JsonProperty("emoji_id") + Optional emojiId(); + + @JsonProperty("emoji_name") + Optional emojiName(); + + @JsonProperty("guild_id") + Possible guildId(); + + boolean available(); + + Possible user(); + +}