Skip to content

Commit

Permalink
Attempt to fix a request handler
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Sep 1, 2024
1 parent 96ead18 commit 1c8aecf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/me/duncte123/lyrics/lavalink/RestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public RestHandler(SocketServer socketServer, Config config, AbstractRoutePlanne
}

@GetMapping(value = "/v4/lyrics/{videoId}")
public Lyrics getLyrics(@PathVariable String videoId) {
public Lyrics getLyrics(@PathVariable("videoId") String videoId) {
try {
return ytClient.requestLyrics(videoId).get();
} catch (Exception e) {
Expand All @@ -59,7 +59,10 @@ public Lyrics getLyrics(@PathVariable String videoId) {
}

@GetMapping(value = "/v4/lyrics/search")
public Object search(@RequestParam String query, @RequestParam(required = false, defaultValue = "youtube") String source) {
public Object search(
@RequestParam("query") String query,
@RequestParam(name = "source", required = false, defaultValue = "youtube") String source
) {
try {
return switch (source.toLowerCase(Locale.ROOT)) {
case "youtube" -> ytClient.search(query, config.getCountryCode()).get();
Expand All @@ -80,7 +83,7 @@ public Object search(@RequestParam String query, @RequestParam(required = false,
}

@GetMapping(value = "/v4/sessions/{sessionId}/players/{guildId}/lyrics")
public Lyrics getLyricsOfPlayingTrack(@PathVariable String sessionId, @PathVariable long guildId) throws Exception {
public Lyrics getLyricsOfPlayingTrack(@PathVariable("sessionId") String sessionId, @PathVariable("guildId") long guildId) throws Exception {
final var playingTrack = socketContext(socketServer, sessionId)
.getPlayer(guildId)
.getTrack();
Expand Down

0 comments on commit 1c8aecf

Please sign in to comment.