Skip to content

Commit

Permalink
Add JDA#retrieveDefaultSoundboardSounds
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Oct 15, 2024
1 parent 000b874 commit 2359285
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/net/dv8tion/jda/api/JDA.java
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,10 @@ default List<RichCustomEmoji> getEmojisByName(@Nonnull String name, boolean igno
@CheckReturnValue
RestAction<@Unmodifiable List<StickerPack>> retrieveNitroStickerPacks();

@Nonnull
@CheckReturnValue
RestAction<@Unmodifiable List<SoundboardSound>> retrieveDefaultSoundboardSounds();

/**
* The EventManager used by this JDA instance.
*
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/net/dv8tion/jda/internal/JDAImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
import net.dv8tion.jda.internal.utils.config.ThreadingConfig;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import org.jetbrains.annotations.Unmodifiable;
import org.slf4j.Logger;
import org.slf4j.MDC;

Expand Down Expand Up @@ -713,6 +714,21 @@ public RestAction<List<StickerPack>> retrieveNitroStickerPacks()
});
}

@Nonnull
@Override
public RestAction<@Unmodifiable List<SoundboardSound>> retrieveDefaultSoundboardSounds()
{
final Route.CompiledRoute route = Route.SoundboardSounds.LIST_DEFAULT_SOUNDBOARD_SOUNDS.compile();
return new RestActionImpl<>(this, route, (response, request) ->
{
final DataArray array = response.getArray();
List<SoundboardSound> sounds = new ArrayList<>(array.length());
for (int i = 0; i < array.length(); i++)
sounds.add(entityBuilder.createSoundboardSound(array.getObject(i)));
return Collections.unmodifiableList(sounds);
});
}

@Nonnull
@Override
public SnowflakeCacheView<ScheduledEvent> getScheduledEventCache()
Expand Down

0 comments on commit 2359285

Please sign in to comment.