use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class AudioPlayerLoadResultHandler method noMatches.
@Override
public void noMatches() {
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(textChannel.getJDA().getSelfUser().getName(), null, textChannel.getJDA().getSelfUser().getEffectiveAvatarUrl());
embedBuilder.setColor(DiscordUtil.ERROR);
embedBuilder.setTitle("No matches found!", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class AudioPlayerLoadResultHandler method loadFailed.
@Override
public void loadFailed(FriendlyException exception) {
LogHelper.error("Failed to load - " + exception.getMessage());
exception.printStackTrace();
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(textChannel.getJDA().getSelfUser().getName(), null, textChannel.getJDA().getSelfUser().getEffectiveAvatarUrl());
embedBuilder.setColor(DiscordUtil.ERROR);
embedBuilder.addField("Failed to load", exception.getMessage(), false);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class AudioQueue method playNext.
public void playNext() {
Audio audio = getNext();
if (audio == null) {
DiscordBot.getInstance().getDiscord().getAudioPlayer().playTrack(null);
return;
}
DiscordBot.getInstance().getDiscord().getAudioPlayer().playTrack(audio.getAudioTrack());
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(audio.getTextChannel().getJDA().getSelfUser().getName(), null, audio.getTextChannel().getJDA().getSelfUser().getEffectiveAvatarUrl());
embedBuilder.setColor(DiscordUtil.DEFAULT);
embedBuilder.addField("Now playing", audio.getAudioTrack().getInfo().title, false);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(audio.getTextChannel(), embedBuilder.build(), true);
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class RemoveCommand method execute.
@Override
public void execute(TextChannel textChannel, Member member, Message message, List<String> arguments) {
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(textChannel.getJDA().getSelfUser().getName(), null, textChannel.getJDA().getSelfUser().getEffectiveAvatarUrl());
embedBuilder.setColor(DiscordUtil.DEFAULT);
if (arguments == null || arguments.isEmpty()) {
embedBuilder.setColor(DiscordUtil.ERROR);
embedBuilder.setTitle("Invalid arguments!", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
return;
}
if (DiscordBot.getInstance().getDiscord().getAudioQueue().getQueue() == null || DiscordBot.getInstance().getDiscord().getAudioQueue().getQueue().isEmpty()) {
embedBuilder.setColor(DiscordUtil.ERROR);
embedBuilder.setTitle("Queue is empty!", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
return;
}
if (arguments.get(0).equalsIgnoreCase("all")) {
DiscordBot.getInstance().getDiscord().getAudioQueue().getQueue().clear();
embedBuilder.setColor(DiscordUtil.SUCCESS);
embedBuilder.setTitle("All songs from queue removed.", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
return;
}
try {
int index = (Integer.parseInt(arguments.get(0)) - 1);
if (index > DiscordBot.getInstance().getDiscord().getAudioQueue().getQueue().size() || index < 0) {
throw new NumberFormatException();
}
Audio audio = DiscordBot.getInstance().getDiscord().getAudioQueue().getQueue().remove(index);
embedBuilder.setColor(DiscordUtil.SUCCESS);
if (audio != null && audio.getAudioTrack() != null) {
embedBuilder.setTitle("Removed '" + audio.getAudioTrack().getInfo().title + "'.");
} else {
embedBuilder.setTitle("Removed '" + "Unknown" + "'.");
}
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
} catch (NumberFormatException ex) {
embedBuilder.setColor(DiscordUtil.ERROR);
embedBuilder.setTitle("Supplied value is outside the queue range!", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
return;
}
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class AudioPlayerLoadResultHandler method trackLoaded.
@Override
public void trackLoaded(AudioTrack audioTrack) {
if (audioTrack == null) {
return;
}
Audio audio = new Audio(getTextChannel(), getMember(), audioTrack);
DiscordBot.getInstance().getDiscord().getAudioQueue().getQueue().add(audio);
if (DiscordBot.getInstance().getDiscord().getAudioPlayer().getPlayingTrack() == null) {
DiscordBot.getInstance().getDiscord().getAudioQueue().playNext();
} else {
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(textChannel.getJDA().getSelfUser().getName(), null, textChannel.getJDA().getSelfUser().getEffectiveAvatarUrl());
embedBuilder.setColor(DiscordUtil.SUCCESS);
embedBuilder.setTitle("'" + audio.getAudioTrack().getInfo().title + "' Has been added to the queue.", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
audio = null;
}
Aggregations