Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
brendonmiranda committed Jan 5, 2025
1 parent 2d7ebf9 commit b05892d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ public void command(SlashCommandEvent event) {
if (audioPlayer.isPaused()) {
audioPlayer.setPaused(false);
event.replyEmbeds(MessageUtil.buildMessage("Resumed", audioPlayer.getPlayingTrack().getInfo().title))
.queue();
.queue();
return;
}

if (audioPlayer.getPlayingTrack() != null) {
audioPlayer.setPaused(true);

event.replyEmbeds(MessageUtil.buildMessage("Paused",
audioPlayer.getPlayingTrack().getInfo().title + ". \n\nType `/resume` to unpause.")).queue();
audioPlayer.getPlayingTrack().getInfo().title + ". \n\nType `/resume` to unpause."))
.queue();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public PlayCmd() {
this.help = "it plays or queues a song";

this.options = Collections
.singletonList(new OptionData(OptionType.STRING, MUSIC_ARG, "What you wanna play ?").setRequired(true));
.singletonList(new OptionData(OptionType.STRING, MUSIC_ARG, "What you wanna play ?").setRequired(true));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void command(SlashCommandEvent event) {
if (audioPlayer.getPlayingTrack() != null && audioPlayer.isPaused()) {
audioPlayer.setPaused(false);
event.replyEmbeds(MessageUtil.buildMessage("Resumed", audioPlayer.getPlayingTrack().getInfo().title))
.queue();
.queue();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ public JDA load(PlayCmd playCmd, StopCmd stopCmd, PauseCmd pauseCmd, ResumeCmd r

JDA jda = JDABuilder.createDefault(token).build();

CommandClient cmdListener = new CommandClientBuilder().setPrefix(prefix).setOwnerId(Long.toString(owner))
.addSlashCommands(playCmd, stopCmd, pauseCmd, resumeCmd, skipCmd, nowPlayingCmd, joinCmd)
.setActivity(listening("type /join")).build();
CommandClient cmdListener = new CommandClientBuilder().setPrefix(prefix)
.setOwnerId(Long.toString(owner))
.addSlashCommands(playCmd, stopCmd, pauseCmd, resumeCmd, skipCmd, nowPlayingCmd, joinCmd)
.setActivity(listening("type /join"))
.build();
// todo: set watching activity

jda.addEventListener(cmdListener, eventWaiter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ public PlayResultHandler(AudioPlayer audioPlayer, Guild guild, AudioManager audi
this.eventWaiter = eventWaiter;
this.message = message;
this.ytSearch = ytSearch;
this.builder = new OrderedMenu.Builder().allowTextInput(true).useNumbers().useCancelButton(true)
.setEventWaiter(eventWaiter).setTimeout(1, TimeUnit.MINUTES);
this.builder = new OrderedMenu.Builder().allowTextInput(true)
.useNumbers()
.useCancelButton(true)
.setEventWaiter(eventWaiter)
.setTimeout(1, TimeUnit.MINUTES);
this.audioQueueService = audioQueueService;
}

Expand Down Expand Up @@ -107,9 +110,11 @@ private void queueTrack(AudioPlayer audioPlayer, AudioTrack track) {
event.getChannel().sendMessageEmbeds(MessageUtil.buildMessage("Enqueued", track.getInfo().title)).queue();

if (audioPlayer.isPaused()) {
event.getChannel().sendMessageEmbeds(MessageUtil.buildMessage("Alert", "The track `"
+ audioPlayer.getPlayingTrack().getInfo().title + "` is paused. \n\nType `/resume` to unpause."))
.queue();
event.getChannel()
.sendMessageEmbeds(MessageUtil.buildMessage("Alert",
"The track `" + audioPlayer.getPlayingTrack().getInfo().title
+ "` is paused. \n\nType `/resume` to unpause."))
.queue();

}

Expand All @@ -120,8 +125,8 @@ private void playTrack(AudioPlayer audioPlayer, AudioTrack track) {
audioPlayer.playTrack(track);

event.getChannel()
.sendMessageEmbeds(MessageUtil.buildMessage("Playing", audioPlayer.getPlayingTrack().getInfo().title))
.queue();
.sendMessageEmbeds(MessageUtil.buildMessage("Playing", audioPlayer.getPlayingTrack().getInfo().title))
.queue();

}

Expand Down Expand Up @@ -152,8 +157,9 @@ public void playlistLoaded(final AudioPlaylist playlist) {

}
else {
event.getChannel().sendMessageEmbeds(MessageUtil.buildMessage("Sorry, I'm unable to load a playlist."))
.queue();
event.getChannel()
.sendMessageEmbeds(MessageUtil.buildMessage("Sorry, I'm unable to load a playlist."))
.queue();
}
}

Expand All @@ -172,9 +178,9 @@ public void noMatches() {
event, audioPlayerManager, eventWaiter, message, true, audioQueueService));
else
event.getChannel()
.sendMessageEmbeds(MessageUtil
.buildMessage("Sorry, I couldn't find your track. Please, rephrase and try again."))
.queue();
.sendMessageEmbeds(
MessageUtil.buildMessage("Sorry, I couldn't find your track. Please, rephrase and try again."))
.queue();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void enqueue() throws InterruptedException {

doAnswer(answer).when(listener).foo(audioTrackMessageDTO); // count down
given(audioTrackToAudioTrackMessageDTOConverter.convert(ArgumentMatchers.any(AudioTrack.class)))
.willReturn(audioTrackMessageDTO);
.willReturn(audioTrackMessageDTO);

// send twice
service.enqueue(queueName, mock(AudioTrack.class));
Expand Down

0 comments on commit b05892d

Please sign in to comment.