use of sx.blah.discord.util.EmbedBuilder in project S-argo by Expugn.
the class TicketScout method displayAndSave.
/**
* Displays the scout results to the channel where the command
* was requested and save the results to the user file afterwards.
* If the results fail to display for any reason then the user file
* is not saved.
*/
void displayAndSave() {
if (!SIMPLE_MESSAGE) {
setupScoutMenu();
if (!generateImage || IMAGE_DISABLED)
scoutMenu.appendField("- Weapon Result -", itemString, false);
scoutMenu.withAuthorIcon(new GitHubImage("images/System/Scout_Icon.png").getURL());
scoutMenu.withColor(255, 255, 255);
scoutMenu.withFooterIcon(new GitHubImage("images/System/Memory_Diamond_Icon.png").getURL());
scoutMenu.withFooterText((CHANNEL.getGuild().getUserByID(Long.parseLong(DISCORD_ID)).getName() + "#" + CHANNEL.getGuild().getUserByID(Long.parseLong(DISCORD_ID)).getDiscriminator()) + " | " + userTotalScouts + " Total Ticket Scouts");
IMessage display = null;
try {
if (generateImage && !IMAGE_DISABLED)
display = CHANNEL.sendFile(scoutMenu.build(), new File(tempUserDirectory + "/results.png"));
else
display = CHANNEL.sendMessage(scoutMenu.build());
} catch (FileNotFoundException e) {
CHANNEL.sendMessage(new WarningMessage("FAILED TO GENERATE IMAGE", "Unable to display scout result.").get().build());
display.delete();
deleteTempDirectory();
return;
} catch (RateLimitException e) {
EmbedBuilder rateLimited = new WarningMessage("RATE LIMIT EXCEPTION", "Slow down on the requests!").get();
try {
display.edit(rateLimited.build());
} catch (NullPointerException a) {
// DO SOMETHING
}
deleteTempDirectory();
return;
}
} else {
setupScoutMenu();
if (!generateImage || IMAGE_DISABLED) {
simpleMessage += "**- Weapon Result -**" + "\n";
simpleMessage += itemString;
}
simpleMessage += (CHANNEL.getGuild().getUserByID(Long.parseLong(DISCORD_ID)).getName() + "#" + CHANNEL.getGuild().getUserByID(Long.parseLong(DISCORD_ID)).getDiscriminator()) + " | " + userTotalScouts + " Total Ticket Scouts";
IMessage display = null;
try {
if (generateImage && !IMAGE_DISABLED) {
display = CHANNEL.sendFile(simpleMessage, new File(tempUserDirectory + "/results.png"));
} else {
display = CHANNEL.sendMessage(simpleMessage);
}
} catch (FileNotFoundException e) {
CHANNEL.sendMessage(new WarningMessage("FAILED TO GENERATE IMAGE", "Unable to display scout result.").get().build());
display.delete();
deleteTempDirectory();
return;
} catch (RateLimitException e) {
EmbedBuilder rateLimited = new WarningMessage("RATE LIMIT EXCEPTION", "Slow down on the requests!").get();
try {
display.edit(rateLimited.build());
} catch (NullPointerException a) {
// DO SOMETHING
}
deleteTempDirectory();
return;
}
}
USER.upgradeExchangeSwords();
USER.saveData();
deleteTempDirectory();
}
use of sx.blah.discord.util.EmbedBuilder in project S-argo by Expugn.
the class SargoException method getEmbedObject.
protected EmbedObject getEmbedObject(String title, String content, int errorCode) {
EmbedBuilder builder = new EmbedBuilder();
builder.withTitle(title);
builder.withDescription(content);
builder.withFooterText("Error Code: " + errorCode);
builder.withColor(255, 0, 0);
return builder.build();
}
use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.
the class Item method getMoreEmbedObject.
@Override
public EmbedObject getMoreEmbedObject(Language lg) {
EmbedBuilder builder = new EmbedBuilder();
builder.withTitle(name);
builder.withUrl(url);
if (description != null && !description.isEmpty())
builder.withDescription(description);
builder.withColor(new Random().nextInt(16777216));
builder.withImage(skinURL);
if (level != null && !level.isEmpty())
builder.appendField(Translator.getLabel(lg, "item.niveau"), level, true);
builder.appendField(Translator.getLabel(lg, "item.type"), type, true);
if (effects != null && !effects.isEmpty())
builder.appendField(Translator.getLabel(lg, "item.effets"), effects, true);
if (caracteristics != null && !caracteristics.isEmpty())
builder.appendField(Translator.getLabel(lg, "item.caracteristiques"), caracteristics, true);
if (conditions != null && !conditions.isEmpty())
builder.appendField(Translator.getLabel(lg, "item.conditions"), conditions, true);
if (panoplie != null && panoplieURL != null)
builder.appendField(Translator.getLabel(lg, "item.panoplie"), "[" + panoplie + "](" + panoplieURL + ")", true);
if (recipe != null)
builder.appendField(Translator.getLabel(lg, "item.recette"), recipe, true);
return builder.build();
}
use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.
the class Monster method getMoreEmbedObject.
@Override
public EmbedObject getMoreEmbedObject(Language lg) {
EmbedBuilder builder = new EmbedBuilder();
builder.withTitle(name);
builder.withUrl(url);
builder.withColor(new Random().nextInt(16777216));
builder.withImage(skinURL);
if (level != null && !level.isEmpty())
builder.appendField(Translator.getLabel(lg, "monster.level"), level, true);
builder.appendField(Translator.getLabel(lg, "monster.race"), family, true);
if (caracteristics != null && !caracteristics.isEmpty())
builder.appendField(Translator.getLabel(lg, "monster.caracteristic"), caracteristics, true);
if (resistances != null && !resistances.isEmpty())
builder.appendField(Translator.getLabel(lg, "monster.resistance"), resistances, true);
if (zones != null && !zones.isEmpty())
builder.appendField(Translator.getLabel(lg, "monster.zones"), zones, true);
if (!butins.isEmpty())
for (int i = 0; i < butins.size(); i++) builder.appendField(Translator.getLabel(lg, "monster.butins") + (butins.size() > 1 ? " (" + (i + 1) + "/" + butins.size() + ")" : "") + " : ", butins.get(i), true);
if (!butinsConditionne.isEmpty())
for (int i = 0; i < butinsConditionne.size(); i++) builder.appendField(Translator.getLabel(lg, "monster.butins_conditionnes") + (butinsConditionne.size() > 1 ? " (" + (i + 1) + "/" + butinsConditionne.size() + ")" : "") + " : ", butinsConditionne.get(i), true);
return builder.build();
}
use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.
the class Portal method getEmbedObject.
@Override
public EmbedObject getEmbedObject(Language lg) {
EmbedBuilder builder = new EmbedBuilder();
builder.withTitle(name);
builder.withColor(getColor());
builder.withThumbnail(url);
if (!isValid()) {
coordonate = new Position();
utilisation = -1;
builder.withDescription(Translator.getLabel(lg, "portal.unknown"));
} else {
builder.appendField(Translator.getLabel(lg, "portal.position"), "**" + coordonate + "**", true);
if (utilisation != -1)
builder.appendField(Translator.getLabel(lg, "portal.utilisation.title"), utilisation + " " + Translator.getLabel(lg, "portal.utilisation.desc") + (utilisation > 1 ? "s" : ""), true);
if (transportLimited != null)
builder.appendField(Translator.getLabel(lg, "portal.private_zaap"), transportLimited.toDiscordString(lg), false);
builder.appendField(Translator.getLabel(lg, "portal.zaap"), zaap.toDiscordString(lg), false);
builder.withFooterText(getDateInformation(creationSource, updateSource, lg));
}
return builder.build();
}
Aggregations