Bot now skips song at when half the call votes to

This commit is contained in:
TiddyT 2022-05-16 18:09:53 -05:00
parent efbd1d0b5d
commit 2659a0ac52

View file

@ -135,12 +135,13 @@ public class MusicCommand extends CommandClass {
e.getHook().sendMessage("\u26A0 You've already voted to skip this song!").queue();
} else {
int votes = info.getSkips();
if (votes >= 3) { // Skip on 4th vote
int size = info.getAuthor().getVoiceState().getChannel().getMembers().size() - 1;
if (votes >= (size/2)) { // Skips when half the channel votes
getPlayer(e.getGuild()).stopTrack();
e.getHook().sendMessage("\u23E9 Skipping current track.").queue();
} else {
info.addSkip(e.getUser());
e.getHook().sendMessage("**" + e.getUser().getName() + "** voted to skip the track. [" + (votes + 1) + "/4").queue();
e.getHook().sendMessage("**" + e.getUser().getName() + "** voted to skip the track. [" + (votes + 1) + "/" + (size/2) + "]").queue();
}
}
}