Skip to content

Commit

Permalink
Fix extremely minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberedCake committed Jan 29, 2024
1 parent 2ad7596 commit d7dc074
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void command(SlashCommandInteractionEvent event) {

MusicPlayer musicPlayer = PresetExceptions.trackIsNotPlaying(event, event.getMember(), true);
if(musicPlayer == null) return;
Embeds.sendNowPlayingStatus(event, musicPlayer.getAudioPlayer().getPlayingTrack(), event.getGuild());
Embeds.sendNowPlayingStatus(event, musicPlayer.getAudioPlayer().getPlayingTrack());
}

@Override
Expand All @@ -32,6 +32,6 @@ public void button(ButtonInteractionEvent event, String buttonId) {
assert event.getMember() != null;
MusicPlayer musicPlayer = PresetExceptions.trackIsNotPlaying(event, event.getMember(), true);
if(musicPlayer == null) return;
Embeds.sendNowPlayingStatus(event, musicPlayer.getAudioPlayer().getPlayingTrack(), event.getGuild());
Embeds.sendNowPlayingStatus(event, musicPlayer.getAudioPlayer().getPlayingTrack());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,15 @@ public static Pair<TextChannel, Long> sendSongPlayingStatus(AudioTrack track, Gu
return new Pair<>(message.getChannel().asTextChannel(), message.getIdLong());
}

public static void sendNowPlayingStatus(IReplyCallback event, AudioTrack track, Guild guild) {
public static void sendNowPlayingStatus(IReplyCallback event, AudioTrack track) {
int percentage = NumberUtils.asRoundedInt((((double)track.getPosition() / (double)track.getDuration()) * 100D));

EmbedBuilder builder = new EmbedBuilder();
builder.setColor(Colors.NOW_PLAYING.get());
builder.setThumbnail(track.getInfo().artworkUrl);
builder.setAuthor(track.getInfo().author);
builder.setTitle(track.getInfo().title, track.getInfo().uri);
builder.setDescription(TrackUtils.getDuration(track.getPosition(), track.getDuration()) + " (**" + NumberUtils.asRoundedInt((double) track.getPosition() / track.getDuration()) + "%**)");
builder.setDescription(TrackUtils.getDuration(track.getPosition(), track.getDuration()) + " (**" + percentage + "%**)");
if(track.getUserData() != null)
builder.addField("Requested By", "<@" + TrackUtils.deserializeUserData(track.getUserData()).getFirstItem().getId() + ">", false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static String getDuration(long current, long max) {
bar.append(":radio_button:");
else
bar.append("▬");
currentLoop += 0.1;
currentLoop += 0.1F;
}
return getFormattedDuration(current) + " " + bar + " " + getFormattedDuration(max);
}
Expand Down

0 comments on commit d7dc074

Please sign in to comment.