use of net.dv8tion.jda.core.managers.AudioManager in project Ardent by adamint.
the class Resume method noArgs.
@Override
public void noArgs(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
AudioManager audioManager = guild.getAudioManager();
Member member = guild.getMember(user);
if (UserUtils.hasManageServerOrStaff(member) || UserUtils.isBotCommander(member)) {
if (audioManager.isConnected()) {
GuildMusicManager manager = getGuildAudioPlayer(guild, channel);
if (manager.player.isPaused()) {
sendTranslatedMessage("Resumed music playback", sendTo(channel, guild), user);
manager.player.setPaused(false);
} else {
sendTranslatedMessage("The player isn't paused", channel, user);
}
} else
sendTranslatedMessage("I'm not in a voice channel!", channel, user);
} else
sendTranslatedMessage("You need the Manage Server permission to do this", channel, user);
}
use of net.dv8tion.jda.core.managers.AudioManager in project Ardent by adamint.
the class Shuffle method noArgs.
@Override
public void noArgs(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
AudioManager audioManager = guild.getAudioManager();
Member member = guild.getMember(user);
if (UserUtils.hasManageServerOrStaff(member) || UserUtils.isBotCommander(member) || (audioManager.isConnected() && audioManager.getConnectedChannel().getMembers().size() == 2)) {
if (audioManager.isConnected()) {
GuildMusicManager manager = getGuildAudioPlayer(guild, channel);
manager.scheduler.manager.shuffle();
sendTranslatedMessage("Shuffled the queue!", sendTo(channel, guild), user);
} else
sendTranslatedMessage("I'm not in a voice channel!", channel, user);
} else
sendTranslatedMessage("You need the Manage Server permission to do this", channel, user);
}
use of net.dv8tion.jda.core.managers.AudioManager in project Ardent by adamint.
the class Skip method noArgs.
@Override
public void noArgs(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
AudioManager audioManager = guild.getAudioManager();
Member member = guild.getMember(user);
if (audioManager.isConnected()) {
GuildMusicManager manager = getGuildAudioPlayer(guild, channel);
ArdentMusicManager ardentMusicManager = manager.scheduler.manager;
ArdentTrack track = ardentMusicManager.getCurrentlyPlaying();
if (track != null) {
String ownerId = track.getAuthor();
if (ownerId == null)
ownerId = "";
if (UserUtils.hasManageServerOrStaff(member) || UserUtils.isBotCommander(member) || user.getId().equalsIgnoreCase(ownerId)) {
ardentMusicManager.nextTrack();
sendTranslatedMessage("Skipped the playing song", sendTo(channel, guild), user);
} else {
sendTranslatedMessage("You need to have queued the song or have the Manage Server permission", sendTo(channel, guild), user);
}
}
} else
sendTranslatedMessage("I'm not in a voice channel!", channel, user);
}
use of net.dv8tion.jda.core.managers.AudioManager 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);
}
use of net.dv8tion.jda.core.managers.AudioManager in project Ardent by adamint.
the class ClearQueue method noArgs.
@Override
public void noArgs(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
AudioManager audioManager = guild.getAudioManager();
Member member = guild.getMember(user);
if (UserUtils.hasManageServerOrStaff(member) || (audioManager.isConnected() && audioManager.getConnectedChannel().getMembers().size() == 2)) {
if (audioManager.isConnected()) {
GuildMusicManager manager = getGuildAudioPlayer(guild, channel);
manager.scheduler.manager.resetQueue();
sendTranslatedMessage("Cleared all songs from the queue", channel, user);
} else
sendTranslatedMessage("I'm not in a voice channel!", channel, user);
} else
sendTranslatedMessage("You need the Manage Server permission to do this", channel, user);
}
Aggregations