use of com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo in project Ardent by adamint.
the class TrackScheduler method onTrackStart.
@Override
public void onTrackStart(AudioPlayer player, AudioTrack track) {
if (manager.isShouldAnnounce()) {
if (manager.getLastAnnouncementId() != null) {
try {
manager.getChannel().getMessageById(manager.getLastAnnouncementId()).queue(message -> message.delete().queue());
} catch (Exception ignored) {
}
}
User me = manager.getChannel().getGuild().getSelfMember().getUser();
AudioTrackInfo info = track.getInfo();
EmbedBuilder builder = MessageUtils.getDefaultEmbed(me);
builder.setAuthor("Now playing " + info.title, "https://ardentbot.tk", "https://s-media-cache-ak0.pinimg" + ".com/736x/69/96/5c/69965c2849ec9b7148a5547ce6714735.jpg");
builder.setThumbnail("https://s-media-cache-ak0.pinimg.com/736x/69/96/5c/69965c2849ec9b7148a5547ce6714735.jpg");
builder.addField("Title", info.title, true).addField("Author", info.author, true).addField("Duration", Music.getDuration(track), true).addField("URL", info.uri, true).addField("Is Stream", String.valueOf(info.isStream), true);
Message m = GuildUtils.getShard(manager.getChannel().getJDA()).help.sendEmbed(builder, manager.getChannel(), me);
manager.setLastAnnouncementId(m.getId());
}
}
use of com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo in project Ardent by adamint.
the class GetUrl method noArgs.
@Override
public void noArgs(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
AudioManager audioManager = guild.getAudioManager();
if (audioManager.isConnected()) {
try {
GuildMusicManager manager = getGuildAudioPlayer(guild, channel);
BlockingQueue<ArdentTrack> queue = manager.scheduler.manager.getQueue();
if (args.length > 1) {
int numberToRemove = Integer.parseInt(args[1]) - 1;
if (numberToRemove >= queue.size() || numberToRemove < 0)
sendTranslatedMessage("Invalid arguments", channel, user);
else {
Iterator<ArdentTrack> iterator = queue.iterator();
int current = 0;
while (iterator.hasNext()) {
ArdentTrack ardentTrack = iterator.next();
AudioTrack track = ardentTrack.getTrack();
AudioTrackInfo info = track.getInfo();
String name = info.title;
if (current == numberToRemove) {
sendTranslatedMessage("The streaming link for {0} is {1}".replace("{0}", info.title).replace("{1}", info.uri), channel, user);
return;
}
current++;
}
}
} else {
ArdentMusicManager musicManager = manager.scheduler.manager;
ArdentTrack track = musicManager.getCurrentlyPlaying();
if (track != null) {
AudioTrackInfo info = track.getTrack().getInfo();
sendTranslatedMessage("The streaming link for {0} is {1}".replace("{0}", info.title).replace("{1}", info.uri), channel, user);
} else {
sendTranslatedMessage("I'm not playing anything right now!", channel, user);
}
}
} catch (NumberFormatException ex) {
sendTranslatedMessage("Invalid arguments", channel, user);
}
} else
sendTranslatedMessage("I'm not in a voice channel!", channel, user);
}
Aggregations