use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.
the class Resource method getEmbedObject.
@Override
public EmbedObject getEmbedObject(Language lg) {
EmbedBuilder builder = new EmbedBuilder();
builder.withTitle(name);
builder.withUrl(url);
builder.withColor(new Random().nextInt(16777216));
builder.withThumbnail(skinURL);
if (level != null && !level.isEmpty())
builder.appendField(Translator.getLabel(lg, "resource.niveau"), level, true);
builder.appendField(Translator.getLabel(lg, "resource.type"), type, true);
if (effects != null && !effects.isEmpty())
builder.appendField(Translator.getLabel(lg, "resource.effets"), effects, true);
if (bonus != null && !bonus.isEmpty())
builder.appendField(Translator.getLabel(lg, "resource.bonus"), bonus, true);
if (sorts != null && !sorts.isEmpty())
builder.appendField(Translator.getLabel(lg, "resource.sorts"), sorts, true);
return builder.build();
}
use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.
the class Almanax method getGroupedObject.
public static EmbedObject getGroupedObject(Language lg, Date day, int occurrence) throws IOException {
Date firstDate = DateUtils.addDays(day, 1);
Date lastDate = DateUtils.addDays(day, occurrence);
String title = Translator.getLabel(lg, "almanax.embed.title.1") + " " + discordToBot.format(firstDate) + (occurrence > 1 ? " " + Translator.getLabel(lg, "almanax.embed.title.2") + " " + discordToBot.format(lastDate) : "");
EmbedBuilder builder = new EmbedBuilder();
builder.withTitle(title);
builder.withColor(new Random().nextInt(16777216));
for (int i = 1; i <= occurrence; i++) {
firstDate = DateUtils.addDays(new Date(), i);
Almanax almanax = Almanax.get(lg, firstDate);
builder.appendField(discordToBot.format(firstDate), Translator.getLabel(lg, "almanax.embed.bonus") + " " + almanax.getBonus() + "\n" + Translator.getLabel(lg, "almanax.embed.offrande") + " " + almanax.getOffrande(), true);
}
return builder.build();
}
use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.
the class Character method getEmbedObject.
@Override
public EmbedObject getEmbedObject(Language lg) {
EmbedBuilder builder = new EmbedBuilder();
builder.withTitle(pseudo);
builder.withUrl(url);
builder.withDescription(Translator.getLabel(lg, "whois.desc"));
builder.withColor(new Random().nextInt(16777216));
builder.withThumbnail(littleSkinURL);
builder.withImage(bigSkinURL);
builder.appendField(Translator.getLabel(lg, "whois.level"), level, true);
builder.appendField(Translator.getLabel(lg, "whois.class"), classe, true);
builder.appendField(Translator.getLabel(lg, "whois.server"), server, true);
builder.appendField(Translator.getLabel(lg, "whois.success") + " " + score, Translator.getLabel(lg, "whois.progression") + " " + progression, true);
if (guildName != null)
builder.appendField(Translator.getLabel(lg, "whois.guild"), "[" + guildName + "](" + guildUrl + ")", true);
if (alliName != null)
builder.appendField(Translator.getLabel(lg, "whois.ally"), "[" + alliName + "](" + alliUrl + ")", true);
return builder.build();
}
use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.
the class TwitterListener method createEmbedFor.
public EmbedObject createEmbedFor(Status status) {
EmbedBuilder builder = new EmbedBuilder();
builder.withAuthorName("@" + status.getUser().getScreenName());
builder.withAuthorIcon(status.getUser().getMiniProfileImageURL());
builder.withAuthorUrl("https://twitter.com/" + status.getUser().getScreenName());
builder.withTitle("Tweet");
builder.withUrl("https://twitter.com/" + status.getUser().getScreenName() + "/status/" + status.getId());
builder.withColor(1942002);
builder.withDescription(status.getText());
builder.withThumbnail(Constants.twitterIcon);
if (status.getMediaEntities().length > 0) {
MediaEntity media = status.getMediaEntities()[0];
builder.withImage(media.getMediaURL());
}
return builder.build();
}
use of sx.blah.discord.util.EmbedBuilder in project DisCal-Discord-Bot by NovaFox161.
the class AnnouncementMessageFormatter method getFormatAnnouncementEmbed.
/**
* Gets the EmbedObject for an Announcement.
* @param a The Announcement to embed.
* @return The EmbedObject for the Announcement.
*/
public static EmbedObject getFormatAnnouncementEmbed(Announcement a, GuildSettings settings) {
EmbedBuilder em = new EmbedBuilder();
em.withAuthorIcon(Main.client.getGuildByID(266063520112574464L).getIconURL());
em.withAuthorName("DisCal");
em.withTitle(MessageManager.getMessage("Embed.Announcement.Info.Title", settings));
try {
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.ID", settings), a.getAnnouncementId().toString(), true);
} catch (NullPointerException e) {
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.ID", settings), "ID IS NULL???", true);
}
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.Type", settings), a.getAnnouncementType().name(), true);
if (a.getAnnouncementType().equals(AnnouncementType.SPECIFIC)) {
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.EventID", settings), a.getEventId(), true);
EventData ed = DatabaseManager.getManager().getEventData(a.getGuildId(), a.getEventId());
if (ed.getImageLink() != null && ImageUtils.validate(ed.getImageLink())) {
em.withImage(ed.getImageLink());
}
} else if (a.getAnnouncementType().equals(AnnouncementType.COLOR)) {
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.Color", settings), a.getEventColor().name(), true);
} else if (a.getAnnouncementType().equals(AnnouncementType.RECUR)) {
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.RecurID", settings), a.getEventId(), true);
EventData ed = DatabaseManager.getManager().getEventData(a.getGuildId(), a.getEventId());
if (ed.getImageLink() != null && ImageUtils.validate(ed.getImageLink())) {
em.withImage(ed.getImageLink());
}
}
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.Hours", settings), String.valueOf(a.getHoursBefore()), true);
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.Minutes", settings), String.valueOf(a.getMinutesBefore()), true);
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.Channel", settings), ChannelUtils.getChannelNameFromNameOrId(a.getAnnouncementChannelId(), a.getGuildId()), true);
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.Info", settings), a.getInfo(), false);
if (a.getAnnouncementType().equals(AnnouncementType.COLOR)) {
EventColor c = a.getEventColor();
em.withColor(c.getR(), c.getG(), c.getB());
} else {
em.withColor(56, 138, 237);
}
em.appendField(MessageManager.getMessage("Embed.Announcement.Info.Enabled", settings), a.isEnabled() + "", true);
return em.build();
}
Aggregations