use of sx.blah.discord.util.EmbedBuilder in project KaellyBot by Kaysoro.
the class AboutCommand method request.
@Override
public boolean request(IMessage message) {
if (super.request(message)) {
IUser author = ClientConfig.DISCORD().getApplicationOwner();
EmbedBuilder builder = new EmbedBuilder();
Language lg = Translator.getLanguageFrom(message.getChannel());
builder.withTitle(Translator.getLabel(lg, "about.title").replace("{name}", Constants.name).replace("{version}", Constants.version)).withDesc(Translator.getLabel(lg, "about.desc").replace("{game}", Constants.game)).withColor(new Random().nextInt(16777216)).withThumbnail(ClientConfig.DISCORD().getApplicationIconURL()).withAuthorName(author.getName()).withAuthorIcon(author.getAvatarURL()).withImage(Constants.changelog);
;
builder.appendField(Translator.getLabel(lg, "about.invite.title"), Translator.getLabel(lg, "about.invite.desc").replace("{name}", Constants.name).replace("{invite}", Constants.invite), true).appendField(Translator.getLabel(lg, "about.support.title"), Translator.getLabel(lg, "about.support.desc").replace("{name}", Constants.name).replace("{discordInvite}", Constants.discordInvite), true).appendField(Translator.getLabel(lg, "about.twitter.title"), Translator.getLabel(lg, "about.twitter.desc").replace("{name}", Constants.name).replace("{twitter}", Constants.twitterAccount), true).appendField(Translator.getLabel(lg, "about.opensource.title"), Translator.getLabel(lg, "about.opensource.desc").replace("{git}", Constants.git), true).appendField(Translator.getLabel(lg, "about.free.title"), Translator.getLabel(lg, "about.free.desc").replace("{paypal}", Constants.paypal), true);
StringBuilder st = new StringBuilder();
for (Donator donator : Donator.values()) st.append(donator.getName()).append(", ");
st.setLength(st.length() - 2);
builder.appendField(Translator.getLabel(lg, "about.donators.title"), st.toString() + ".", true);
Message.sendEmbed(message.getChannel(), builder.build());
return true;
}
return false;
}
use of sx.blah.discord.util.EmbedBuilder in project S-argo by Expugn.
the class Profile method init.
/**
* Initializes the EmbedMessage and variables.
*/
private void init() {
builder = new EmbedBuilder();
iUser = CHANNEL.getGuild().getUserByID(Long.parseLong(DISCORD_ID));
user = new UserParser(DISCORD_ID);
userName = iUser.getName() + "#" + iUser.getDiscriminator();
goldCount = 0;
platinumCount = 0;
bannerType = new TreeMap<>();
builder.withAuthorName(userName + "'s Profile");
builder.withAuthorIcon(iUser.getAvatarURL());
builder.withColor(255, 86, 91);
builder.withThumbnail(new GitHubImage("images/System/Profile_Icon.png").getURL());
}
use of sx.blah.discord.util.EmbedBuilder in project S-argo by Expugn.
the class CharacterScout 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() {
ScoutMasterParser smp = new ScoutMasterParser();
if (!SIMPLE_MESSAGE) {
scoutMenu.withAuthorName(SELECTED_BANNER.getBannerName());
setupScoutMenu();
if (!generateImage || IMAGE_DISABLED)
scoutMenu.appendField("- Scout Result -", characterString, false);
scoutMenu.withDesc(smp.getQuote());
scoutMenu.withAuthorIcon(new GitHubImage("images/System/Scout_Icon.png").getURL());
scoutMenu.withColor(244, 233, 167);
scoutMenu.withThumbnail(smp.getImage(highestRarity));
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()) + " | " + USER.getMemoryDiamonds() + " Memory Diamonds Left");
LOGGER.debug("Displaying Scout Result...");
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 {
simpleMessage += "**" + SELECTED_BANNER.getBannerName() + "**" + "\n";
setupScoutMenu();
simpleMessage += smp.getQuote() + "\n";
if (!generateImage || IMAGE_DISABLED) {
simpleMessage += "**- Scout Result -**" + "\n";
simpleMessage += characterString;
}
simpleMessage += (CHANNEL.getGuild().getUserByID(Long.parseLong(DISCORD_ID)).getName() + "#" + CHANNEL.getGuild().getUserByID(Long.parseLong(DISCORD_ID)).getDiscriminator()) + " | " + USER.getMemoryDiamonds() + " Memory Diamonds Left";
LOGGER.debug("Displaying Scout Result...");
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;
}
}
LOGGER.debug("Saving User Data...");
USER.saveData();
deleteTempDirectory();
}
use of sx.blah.discord.util.EmbedBuilder in project S-argo by Expugn.
the class CharacterScout method init.
/**
* Initializes all the variables needed for scouts.
*/
private void init() {
/* FILES */
// SETTINGS = new SettingsParser();
BANNERS = BannerParser.getBanners();
USER = new UserParser(DISCORD_ID);
/* SETTINGS */
IS_RARITY_STARS = SettingsParser.isRarityStars();
COPPER = (int) (SettingsParser.getCopperRates() * 100);
SILVER = (int) (SettingsParser.getSilverRates() * 100);
GOLD = (int) (SettingsParser.getGoldRates() * 100);
PLATINUM = (int) (SettingsParser.getPlatinumRates() * 100);
RECORD_CRYSTAL_RATES = SettingsParser.getRecordCrystalRates();
CIRCULATING_RECORD_CRYSTAL_RATES = SettingsParser.getCirculatingRecordCrystalRates();
GOLD_BANNERS = SettingsParser.getGoldBanners();
GOLD_BANNERS_V2 = SettingsParser.getGoldBannersv2();
IMAGE_DISABLED = SettingsParser.isDisableImages();
SIMPLE_MESSAGE = SettingsParser.isSimpleMessage();
/* USER */
userMemoryDiamonds = USER.getMemoryDiamonds();
userHackingCrystals = USER.getHackingCrystals();
userRecordCrystals = 0;
/* VARIABLES */
RNG = new Random(System.currentTimeMillis());
imageStrings = new String[11];
characters = new ArrayList<>();
guaranteeOnePlatinum = false;
guaranteedScout = false;
characterString = "";
tempUserDirectory = new File("images/temp_" + DISCORD_ID);
scoutMenu = new EmbedBuilder();
simpleMessage = "";
/* MEMORY DIAMOND PRICES */
singleScoutPrice = 25;
multiScoutPrice = 250;
/* BANNER */
if (BANNER_ID < BANNERS.size() && BANNER_ID >= 0) {
SELECTED_BANNER = BANNERS.get(BANNER_ID);
BANNER_CHARACTERS = SELECTED_BANNER.getCharacters();
bannerType = SELECTED_BANNER.getBannerType();
bannerTypeData = USER.getBannerData(SELECTED_BANNER.getBannerName());
goldCharacters = new ArrayList<>();
platinumCharacters = new ArrayList<>();
if (USER.isBannerInfoExists(SELECTED_BANNER.getBannerName()) == -1) {
initBannerInfo();
}
for (Character character : BANNER_CHARACTERS) {
if (character.getRarity() == 4) {
goldCharacters.add(character);
} else if (character.getRarity() == 5) {
platinumCharacters.add(character);
}
}
if (platinumCharacters.size() <= 0) {
COPPER += PLATINUM;
PLATINUM = 0;
}
modifyScoutData();
LOGGER.debug("\n- Scout Data -\n" + "Single Price " + singleScoutPrice + "\n" + "Multi Price: " + multiScoutPrice + "\n" + "COPPER: " + COPPER + "%\n" + "SILVER: " + SILVER + "%\n" + "GOLD: " + GOLD + "%\n" + "PLATINUM: " + PLATINUM + "%");
}
}
use of sx.blah.discord.util.EmbedBuilder in project S-argo by Expugn.
the class TicketScout method init.
/**
* Initializes all the variables needed for scouts.
*/
private void init() {
/* FILES */
// SettingsParser SETTINGS = new SettingsParser();
USER = new UserParser(DISCORD_ID);
/* SETTINGS */
// IMAGE_DISABLED = SETTINGS.isDisableImages();
// SIMPLE_MESSAGE = SETTINGS.isSimpleMessage();
// IS_RARITY_STARS = SETTINGS.isRarityStars();
IMAGE_DISABLED = SettingsParser.isDisableImages();
SIMPLE_MESSAGE = SettingsParser.isSimpleMessage();
IS_RARITY_STARS = SettingsParser.isRarityStars();
/* USER */
userColBalance = USER.getColBalance();
userTotalScouts = USER.getTotalTicketScout();
/* VARIABLES */
RNG = new Random(System.currentTimeMillis());
scoutMenu = new EmbedBuilder();
simpleMessage = "";
imageStrings = new String[11];
items = new ArrayList<>();
itemString = "";
tempUserDirectory = new File("images/temp_" + DISCORD_ID);
attributeItemsList = new ArrayList<>();
medallionsAndKeyList = new ArrayList<>();
/* ITEMS */
initItems();
}
Aggregations