From d77c9378185b3381c980f1f832cfd1c52d86875b Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 28 Jun 2024 04:04:50 +0100 Subject: [PATCH] spotify is v silly! --- .../spotify/command/CurrentSubCommand.java | 14 +++++++------- .../features/spotify/command/PauseSubCommand.java | 14 +++++++------- .../cc/fascinated/bat/service/SpotifyService.java | 3 +-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java index 7420b0e..d54bead 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java @@ -42,13 +42,13 @@ public class CurrentSubCommand extends BatSubCommand { return; } -// if (!spotifyService.hasTrackPlaying(user)) { -// interaction.replyEmbeds(EmbedUtils.genericEmbed() -// .setDescription("You are not currently playing a track.") -// .build()) -// .queue(); -// return; -// } + if (!spotifyService.hasTrackPlaying(user)) { + interaction.replyEmbeds(EmbedUtils.genericEmbed() + .setDescription("You are not currently playing a track.") + .build()) + .queue(); + return; + } CurrentlyPlaying currentlyPlaying = spotifyService.getCurrentlyPlayingTrack(user); Track track = (Track) currentlyPlaying.getItem(); AlbumSimplified album = track.getAlbum(); diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java index f6fb55a..77ef74b 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java @@ -36,13 +36,13 @@ public class PauseSubCommand extends BatSubCommand { return; } -// if (!spotifyService.hasTrackPlaying(user)) { -// interaction.replyEmbeds(EmbedUtils.genericEmbed() -// .setDescription("You need to be playing a track to pause it.") -// .build()) -// .queue(); -// return; -// } + if (!spotifyService.hasTrackPlaying(user)) { + interaction.replyEmbeds(EmbedUtils.genericEmbed() + .setDescription("You need to be playing a track to pause it.") + .build()) + .queue(); + return; + } boolean didPause = spotifyService.pausePlayback(user); interaction.replyEmbeds(EmbedUtils.genericEmbed() diff --git a/src/main/java/cc/fascinated/bat/service/SpotifyService.java b/src/main/java/cc/fascinated/bat/service/SpotifyService.java index de8fea3..6d5361e 100644 --- a/src/main/java/cc/fascinated/bat/service/SpotifyService.java +++ b/src/main/java/cc/fascinated/bat/service/SpotifyService.java @@ -86,8 +86,7 @@ public class SpotifyService { try { return getSpotifyApi(user).getUsersCurrentlyPlayingTrack().build().execute(); } catch (Exception e) { - e.printStackTrace(); - return null; + throw new RuntimeException("Failed to get currently playing track", e); } }