use of net.daporkchop.porkbot.audio.GuildAudioInfo in project PorkBot by DaMatrix.
the class CommandShuffle method execute.
public void execute(MessageReceivedEvent evt, String[] split, String rawContent) {
evt.getTextChannel().sendMessage("Shuffling queue...").queue(message -> {
GuildAudioInfo info = AudioUtils.getGuildAudioPlayer(evt.getGuild(), false);
if (info == null) {
message.editMessage("Not playing!").queue();
} else {
BlockingQueue<AudioTrack> queue = info.manager.scheduler.queue;
ArrayList<AudioTrack> queueTemp;
Collections.shuffle(queueTemp = new ArrayList<>(queue));
queue.clear();
queue.addAll(queueTemp);
message.editMessage("Queue shuffled!").queue();
}
});
}
use of net.daporkchop.porkbot.audio.GuildAudioInfo in project PorkBot by DaMatrix.
the class CommandStop method execute.
public void execute(MessageReceivedEvent evt, String[] split, String rawContent) {
GuildAudioInfo info = AudioUtils.getGuildAudioPlayer(evt.getGuild(), false);
if (info == null) {
evt.getTextChannel().sendMessage("Not playing!").queue();
} else {
info.manager.player.destroy();
info.channel.getGuild().getAudioManager().closeAudioConnection();
evt.getTextChannel().sendMessage("Stopped!").queue();
}
}
use of net.daporkchop.porkbot.audio.GuildAudioInfo in project PorkBot by DaMatrix.
the class CommandQueue method execute.
public void execute(MessageReceivedEvent evt, String[] split, String rawContent) {
GuildAudioInfo info = AudioUtils.getGuildAudioPlayer(evt.getGuild(), false);
if (info == null) {
evt.getTextChannel().sendMessage("Not playing!").queue();
} else {
String msg = "Queue: `" + info.manager.scheduler.queue.size() + "` tracks queued\n\nCurrently playing: `" + info.manager.scheduler.player.getPlayingTrack().getInfo().title + "`\n\nQueue:\n";
ArrayList<AudioTrack> tracks = new ArrayList<>(info.manager.scheduler.queue);
for (int i = 0; i < 5 && i < tracks.size(); i++) {
AudioTrack track = tracks.get(i);
long minutes = TimeUnit.MILLISECONDS.toMinutes(track.getInfo().length);
long seconds = TimeUnit.MILLISECONDS.toSeconds(track.getInfo().length);
msg += (i + 1) + ": " + tracks.get(i).getInfo().title + "(`" + minutes + ":" + seconds + "`)\n";
}
MessageUtils.sendMessage(msg, evt.getTextChannel());
}
}
Aggregations