use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class NowPlayingCommand 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);
AudioTrack audioTrack = DiscordBot.getInstance().getDiscord().getAudioPlayer().getPlayingTrack();
if (audioTrack == null) {
embedBuilder.setTitle("Nothing is currently playing.", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
return;
}
embedBuilder.addField("Now playing", audioTrack.getInfo().title, false);
embedBuilder.setFooter(DiscordUtil.getTimestamp(audioTrack.getPosition()) + " / " + DiscordUtil.getTimestamp(audioTrack.getDuration()), null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class PlayCommand 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 (member.getGuild().getAudioManager().getConnectedChannel() == null) {
embedBuilder.setColor(DiscordUtil.ERROR);
embedBuilder.setTitle("Not connected to voice channel!", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
return;
}
if (arguments == null || arguments.isEmpty()) {
if (DiscordBot.getInstance().getDiscord().getAudioPlayer().isPaused()) {
DiscordBot.getInstance().getDiscord().getAudioPlayer().setPaused(false);
embedBuilder.setColor(DiscordUtil.SUCCESS);
embedBuilder.setTitle("Playback resumed.", null);
} else {
DiscordBot.getInstance().getDiscord().getAudioPlayer().setPaused(true);
embedBuilder.setColor(DiscordUtil.WARNING);
embedBuilder.setTitle("Playback paused.", null);
}
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
return;
}
for (Iterator<String> iterator = arguments.iterator(); iterator.hasNext(); ) {
String string = iterator.next();
if (!string.startsWith("https://")) {
continue;
}
DiscordBot.getInstance().getDiscord().getAudioPlayerManager().loadItem(string, new AudioPlayerLoadResultHandler(textChannel, member));
embedBuilder.setColor(DiscordUtil.SUCCESS);
embedBuilder.setTitle("Processing...", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class InfoCommand method execute.
@Override
public void execute(TextChannel textChannel, Member member, Message message, List<String> arguments) {
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(Reference.APP_NAME + " v" + Reference.APP_VERSION, null, textChannel.getJDA().getSelfUser().getEffectiveAvatarUrl());
embedBuilder.setColor(DiscordUtil.DEFAULT);
embedBuilder.addField("Author", "LX_Gaming", false);
embedBuilder.addField("Source", "https://github.com/LXGaming/DiscordBot/", false);
embedBuilder.addField("Dependencies", "" + "\n- " + Reference.JDA_NAME + " v" + Reference.JDA_VERSION + "\n- " + Reference.LAVA_NAME + " v" + Reference.LAVA_VERSION, false);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class HelpCommand 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);
embedBuilder.setTitle("Commands", null);
for (Iterator<ICommand> iterator = DiscordBot.getInstance().getDiscord().getCommand().getRegisteredCommands().iterator(); iterator.hasNext(); ) {
ICommand command = iterator.next();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Description - " + command.getDescription() + "\n");
stringBuilder.append("Usage - " + command.getUsage() + "\n");
if (command.getAliases() != null && !command.getAliases().isEmpty()) {
stringBuilder.append("Aliases - " + String.join(", ", command.getAliases()));
}
embedBuilder.addField(command.getName(), stringBuilder.toString(), false);
}
embedBuilder.setFooter("<> = Required Argument, [] = Optional Argument", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class VolumeCommand 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()) {
try {
int volume = Integer.parseInt(arguments.get(0));
if (volume > 100 || volume < 0) {
volume = DiscordBot.getInstance().getDiscord().getAudioPlayer().getVolume();
}
DiscordBot.getInstance().getDiscord().getAudioPlayer().setVolume(volume);
embedBuilder.setColor(DiscordUtil.SUCCESS);
} catch (NumberFormatException ex) {
embedBuilder.setColor(DiscordUtil.ERROR);
embedBuilder.setTitle("Invalid volume!", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
return;
}
}
embedBuilder.setTitle("Volume - " + DiscordBot.getInstance().getDiscord().getAudioPlayer().getVolume(), null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
Aggregations