use of net.dv8tion.jda.core.EmbedBuilder in project MantaroBot by Mantaro.
the class EmbedJSON method gen.
public MessageEmbed gen(GenericGuildMemberEvent event) {
EmbedBuilder embed = new EmbedBuilder();
if (title != null)
embed.setTitle(title, titleUrl);
if (description != null)
embed.setDescription(description);
if (author != null)
embed.setAuthor(author, authorUrl, authorImg);
if (footer != null)
embed.setFooter(footer, footerImg);
if (image != null)
embed.setImage(image);
if (thumbnail != null)
embed.setThumbnail(thumbnail);
if (color != null) {
Color c = null;
try {
c = (Color) Color.class.getField(color).get(null);
} catch (Exception ignored) {
String colorLower = color.toLowerCase();
if (colorLower.equals("member")) {
c = event.getMember().getColor();
} else if (colorLower.matches("#?(0x)?[0123456789abcdef]{1,6}")) {
try {
c = Color.decode(colorLower.startsWith("0x") ? colorLower : "0x" + colorLower);
} catch (Exception ignored2) {
}
}
}
if (c != null)
embed.setColor(c);
}
fields.forEach(f -> {
if (f == null) {
embed.addBlankField(false);
} else if (f.value == null) {
embed.addBlankField(f.inline);
} else {
embed.addField(f.name == null ? "" : f.name, f.value, f.inline);
}
});
return embed.build();
}
use of net.dv8tion.jda.core.EmbedBuilder in project MOOTBoot by LeshDev.
the class botInfo method onMessageReceived.
public void onMessageReceived(MessageReceivedEvent e) {
Message msg = e.getMessage();
EmbedBuilder eB = new EmbedBuilder();
if (!msg.getRawContent().startsWith("-info") || bannedList.black.contains(e.getAuthor().getIdLong()) || e.getAuthor().isBot()) {
return;
}
System.out.println(e.getAuthor() + " used the following command: -info");
eB.setAuthor(lib.bot_name, null, lib.bot_image);
eB.addField("Creator", "<@!155704314638106624>", true);
eB.addField("GitHub", "[MOOTBooT](https://github.com/LeshDev/MOOTBoot/tree/master/src/de/lesh/mootboot)", true);
eB.addField("Safe since", "28.05.2017 - 21:51", true);
eB.addField("Version", lib.version, true);
eB.setThumbnail(lib.bot_image);
eB.setColor(java.awt.Color.GREEN);
e.getChannel().sendMessage(eB.build()).queue();
}
use of net.dv8tion.jda.core.EmbedBuilder in project MOOTBoot by LeshDev.
the class botPing method onMessageReceived.
public void onMessageReceived(MessageReceivedEvent e) {
Message msg = e.getMessage();
if (!msg.getRawContent().startsWith("-ping") || bannedList.black.contains(e.getAuthor().getIdLong())) {
return;
}
EmbedBuilder eB = new EmbedBuilder();
long start = System.currentTimeMillis();
eB.setAuthor(">> Bot Ping", null, lib.bot_image);
eB.addField("Ping", "**Bot: **" + e.getJDA().getPing() + "ms\n" + "**User: **" + (System.currentTimeMillis() - start) + "ms", false);
eB.setColor(java.awt.Color.MAGENTA);
e.getChannel().sendMessage(eB.build()).queue();
}
use of net.dv8tion.jda.core.EmbedBuilder in project DiscordBot by LXGaming.
the class ClearCommand method execute.
@Override
public void execute(TextChannel textChannel, Member member, Message message, List<String> arguments) {
DiscordBot.getInstance().getDiscord().getAudioQueue().setRepeatQueue(false);
DiscordBot.getInstance().getDiscord().getAudioQueue().setRepeatSong(false);
DiscordBot.getInstance().getDiscord().getAudioQueue().getQueue().clear();
DiscordBot.getInstance().getDiscord().getAudioPlayer().stopTrack();
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(textChannel.getJDA().getSelfUser().getName(), null, textChannel.getJDA().getSelfUser().getEffectiveAvatarUrl());
embedBuilder.setColor(DiscordUtil.DEFAULT);
embedBuilder.setTitle("Queue cleared.", null);
DiscordBot.getInstance().getDiscord().getMessageSender().sendMessage(textChannel, embedBuilder.build(), true);
}
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);
}
Aggregations