Search in sources :

Example 1 with WarningMessage

use of io.github.spugn.Sargo.Objects.WarningMessage in project S-argo by Expugn.

the class GGOStepUp method run.

@Override
protected void run() {
    switch(CHOICE.toLowerCase()) {
        case "ws":
        case "wsi":
            if (userMemoryDiamonds < singleScoutPrice) {
                CHANNEL.sendMessage(new WarningMessage("NOT ENOUGH MEMORY DIAMONDS", "You need **" + singleScoutPrice + "** Memory Diamonds to scout.\nUse '" + CommandManager.getCommandPrefix() + "**shop**' to get more Memory Diamonds.").get().build());
                return;
            }
            if (CHOICE.equalsIgnoreCase("wsi") && !IMAGE_DISABLED) {
                generateImage = true;
            }
            userMemoryDiamonds -= singleScoutPrice;
            USER.setMemoryDiamonds(userMemoryDiamonds);
            doSinglePull();
            break;
        case "wm":
        case "wmi":
            if (userMemoryDiamonds < multiScoutPrice) {
                CHANNEL.sendMessage(new WarningMessage("NOT ENOUGH MEMORY DIAMONDS", "You need **" + multiScoutPrice + "** Memory Diamonds to scout.\nUse '" + CommandManager.getCommandPrefix() + "**shop**' to get more Memory Diamonds.").get().build());
                return;
            }
            if (CHOICE.equalsIgnoreCase("wmi") && !IMAGE_DISABLED) {
                generateImage = true;
            }
            userMemoryDiamonds -= multiScoutPrice;
            USER.setMemoryDiamonds(userMemoryDiamonds);
            doMultiPull();
            updateBannerData();
            break;
        default:
            CHANNEL.sendMessage(new WarningMessage("UNKNOWN/UNAVAILABLE SCOUT TYPE", "Use '" + CommandManager.getCommandPrefix() + "**scout** " + BANNER_ID + "' and read the footer text for available scout types.").get().build());
            return;
    }
    if (stopScout)
        return;
    displayAndSave();
}
Also used : WarningMessage(io.github.spugn.Sargo.Objects.WarningMessage)

Example 2 with WarningMessage

use of io.github.spugn.Sargo.Objects.WarningMessage in project S-argo by Expugn.

the class CommandManager method userCommand.

private void userCommand() {
    if (COMMAND_LINE.getArgumentCount() >= 1) {
        IGuild guild = CHANNEL.getGuild();
        String userDiscordName = COMMAND_LINE.getArgument(1);
        if (!(guild.getUsersByName(userDiscordName).isEmpty())) {
            IUser foundUser = guild.getUsersByName(userDiscordName).get(0);
            new Profile(CHANNEL, foundUser.getStringID());
        } else {
            try {
                String userDiscordID = COMMAND_LINE.getArgument(1);
                userDiscordID = userDiscordID.replaceAll("<", "");
                userDiscordID = userDiscordID.replaceAll("@", "");
                userDiscordID = userDiscordID.replaceAll("!", "");
                userDiscordID = userDiscordID.replaceAll(">", "");
                if (guild.getUserByID(Long.parseLong(userDiscordID)) != null) {
                    IUser foundUser = guild.getUserByID(Long.parseLong(userDiscordID));
                    new Profile(CHANNEL, foundUser.getStringID());
                } else {
                    CHANNEL.sendMessage(new WarningMessage("UNKNOWN USER", "Could not find that user.").get().build());
                }
            } catch (NumberFormatException e) {
                CHANNEL.sendMessage(new WarningMessage("UNKNOWN USER", "Could not find that user. Does their name have a space? Try '" + commandPrefix + "**user** @[name]' instead.").get().build());
            }
        }
    } else {
        CHANNEL.sendMessage(new WarningMessage("NOT ENOUGH ARGUMENTS", "Please review the help menu.").get().build());
    }
}
Also used : WarningMessage(io.github.spugn.Sargo.Objects.WarningMessage)

Example 3 with WarningMessage

use of io.github.spugn.Sargo.Objects.WarningMessage in project S-argo by Expugn.

the class BirthdayStepUp method run.

@Override
protected void run() {
    switch(CHOICE.toLowerCase()) {
        case "s":
        case "si":
            if (userMemoryDiamonds < singleScoutPrice) {
                CHANNEL.sendMessage(new WarningMessage("NOT ENOUGH MEMORY DIAMONDS", "You need **" + singleScoutPrice + "** Memory Diamonds to scout.\nUse '" + CommandManager.getCommandPrefix() + "**shop**' to get more Memory Diamonds.").get().build());
                return;
            }
            if (CHOICE.equalsIgnoreCase("si") && !IMAGE_DISABLED) {
                generateImage = true;
            }
            userMemoryDiamonds -= singleScoutPrice;
            USER.setMemoryDiamonds(userMemoryDiamonds);
            doSinglePull();
            break;
        case "m":
        case "mi":
            if (userMemoryDiamonds < multiScoutPrice) {
                CHANNEL.sendMessage(new WarningMessage("NOT ENOUGH MEMORY DIAMONDS", "You need **" + multiScoutPrice + "** Memory Diamonds to scout.\nUse '" + CommandManager.getCommandPrefix() + "**shop**' to get more Memory Diamonds.").get().build());
                return;
            }
            if (CHOICE.equalsIgnoreCase("mi") && !IMAGE_DISABLED) {
                generateImage = true;
            }
            userMemoryDiamonds -= multiScoutPrice;
            USER.setMemoryDiamonds(userMemoryDiamonds);
            doMultiPull();
            updateBannerData();
            break;
        default:
            CHANNEL.sendMessage(new WarningMessage("UNKNOWN/UNAVAILABLE SCOUT TYPE", "Only `single` and `multi` scouts are available.").get().build());
            return;
    }
    if (stopScout)
        return;
    displayAndSave();
}
Also used : WarningMessage(io.github.spugn.Sargo.Objects.WarningMessage)

Example 4 with WarningMessage

use of io.github.spugn.Sargo.Objects.WarningMessage in project S-argo by Expugn.

the class Event method run.

@Override
protected void run() {
    switch(CHOICE.toLowerCase()) {
        case "s":
        case "si":
            if (userMemoryDiamonds < singleScoutPrice) {
                CHANNEL.sendMessage(new WarningMessage("NOT ENOUGH MEMORY DIAMONDS", "You need **" + singleScoutPrice + "** Memory Diamonds to scout.\nUse '" + CommandManager.getCommandPrefix() + "**shop**' to get more Memory Diamonds.").get().build());
                return;
            }
            if (CHOICE.equalsIgnoreCase("si") && !IMAGE_DISABLED) {
                generateImage = true;
            }
            userMemoryDiamonds -= singleScoutPrice;
            USER.setMemoryDiamonds(userMemoryDiamonds);
            doSinglePull();
            break;
        default:
            CHANNEL.sendMessage(new WarningMessage("UNKNOWN/UNAVAILABLE SCOUT TYPE", "Only `single` scouts are available.").get().build());
            return;
    }
    if (stopScout)
        return;
    displayAndSave();
}
Also used : WarningMessage(io.github.spugn.Sargo.Objects.WarningMessage)

Example 5 with WarningMessage

use of io.github.spugn.Sargo.Objects.WarningMessage 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();
}
Also used : WarningMessage(io.github.spugn.Sargo.Objects.WarningMessage) EmbedBuilder(sx.blah.discord.util.EmbedBuilder) RateLimitException(sx.blah.discord.util.RateLimitException) GitHubImage(io.github.spugn.Sargo.Utilities.GitHubImage) IMessage(sx.blah.discord.handle.obj.IMessage) FileNotFoundException(java.io.FileNotFoundException) File(java.io.File)

Aggregations

WarningMessage (io.github.spugn.Sargo.Objects.WarningMessage)19 GitHubImage (io.github.spugn.Sargo.Utilities.GitHubImage)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IMessage (sx.blah.discord.handle.obj.IMessage)1 EmbedBuilder (sx.blah.discord.util.EmbedBuilder)1 RateLimitException (sx.blah.discord.util.RateLimitException)1