Search in sources :

Example 21 with GenericMessageEvent

use of org.pircbotx.hooks.types.GenericMessageEvent in project LanteaBot by PC-Logix.

the class OCTime method initHook.

@Override
protected void initHook() {
    local_command = new Command("octime") {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
            dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));
            Helper.sendMessage(target, dateFormatGmt.format(new Date()), nick);
            return new CommandChainStateObject();
        }
    };
    local_command.setHelpText("Returns the time in GMT");
    local_command.registerAlias("time");
    IRCBot.registerCommand(local_command);
}
Also used : Command(pcl.lc.irc.entryClasses.Command) CommandChainStateObject(pcl.lc.utils.CommandChainStateObject) GenericMessageEvent(org.pircbotx.hooks.types.GenericMessageEvent) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 22 with GenericMessageEvent

use of org.pircbotx.hooks.types.GenericMessageEvent in project LanteaBot by PC-Logix.

the class Zap method initCommands.

private void initCommands() {
    local_command = new Command("zap", new CommandArgumentParser(0, new CommandArgument(ArgumentTypes.STRING, "Target"), new CommandArgument(ArgumentTypes.STRING, "Item", "If item is not specified tries to use random inventory item."))) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            String zapTarget = this.argumentParser.getArgument("Target");
            if (zapTarget == null)
                Helper.sendAction(target, nick + " makes some sparks");
            else {
                String with = this.argumentParser.getArgument("Item");
                if (Helper.doInteractWith(params)) {
                    Item item = null;
                    if (with == null)
                        item = Inventory.getRandomItem(false);
                    else {
                        try {
                            item = new Item(with, false);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    String dmgString;
                    if (with != null && with.equals("nothing"))
                        item = null;
                    if (item == null)
                        dmgString = "1d6 damage";
                    else
                        dmgString = "1d" + (item.getDiceSizeFromItemName() + 2) + " damage";
                    dmgString = DiceRoll.rollDiceInString(dmgString, true);
                    if (item != null)
                        if (nick.equals(zapTarget))
                            Helper.sendMessage(target, nick + " zaps themselves using " + item.getName(true) + " as a conductor for " + dmgString + "!");
                        else
                            Helper.sendMessage(target, nick + " zaps " + zapTarget + " using " + item.getName(true) + " as a conductor for " + dmgString + "!");
                    else {
                        if (nick.equals(zapTarget))
                            Helper.sendMessage(target, nick + " zaps themselves for " + dmgString + "!");
                        else
                            Helper.sendMessage(target, nick + " zaps " + zapTarget + " for " + dmgString + "!");
                    }
                } else {
                    Helper.sendAction(target, "zaps " + nick + "!");
                }
            }
            return new CommandChainStateObject();
        }
    };
    local_command.setHelpText("Shocking!");
}
Also used : CommandChainStateObject(pcl.lc.utils.CommandChainStateObject) GenericMessageEvent(org.pircbotx.hooks.types.GenericMessageEvent)

Example 23 with GenericMessageEvent

use of org.pircbotx.hooks.types.GenericMessageEvent in project LanteaBot by PC-Logix.

the class Defend method initCommands.

private void initCommands(ArrayList<String> actions) {
    local_command = new Command("defend", new CommandArgumentParser(1, new CommandArgument(ArgumentTypes.STRING, "Action", "One of " + Helper.oxfordJoin(actions, ", ", ", or ")), new CommandArgument(ArgumentTypes.STRING, "Item", "If item is omitted no item will be used."))) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, ArrayList<String> params) throws Exception {
            String method = this.argumentParser.getArgument("Action");
            if (method == null || !actionList.contains(method.toLowerCase())) {
                Helper.sendMessage(target, "Specify an action as the first parameter: " + actionList);
                return new CommandChainStateObject(CommandChainState.ERROR, "Unspecified action");
            }
            ArrayList<DefendEvent> defendEvents = getEventsFor(nick);
            if (defendEvents.size() > 0) {
                DefendEvent defendEvent = defendEvents.get(0);
                defendEventLog.remove(defendEvent);
                int damage = defendEvent.damage;
                int effectiveDamage = defendEvent.damage;
                String implement = defendEvent.implement;
                Item implementItem = null;
                if (!implement.equals(""))
                    implementItem = new Item(implement, false);
                DecimalFormat dec = new DecimalFormat(damageFormat);
                String item = this.argumentParser.getArgument("Item");
                Item defenseItem = null;
                if (item != null) {
                    defenseItem = new Item(String.join(" ", params), false);
                }
                DiceRollBonusCollection attackBonus = DiceRollBonusCollection.getOffensiveItemBonus(implement);
                int dc = defendEvent.type.baseDC + attackBonus.getTotal();
                String dcString = attackBonus.toString();
                dcString = dc + (dcString.equals("") ? "" : " (" + dcString + ")");
                DiceRollBonusCollection defenseBonus = new DiceRollBonusCollection();
                if (defenseItem != null)
                    DiceRollBonusCollection.getDefensiveItemBonus(defenseItem);
                int result = new DiceRoll(20).getSum() + defenseBonus.getTotal();
                String resultString = defenseBonus.toString();
                resultString = result + (resultString.equals("") ? "" : " (" + resultString + ")");
                if (defendEvent.type == EventTypes.ATTACK) {
                    String implementString = implementItem == null ? "" : "wielding " + implementItem.getName(true);
                    if (result >= (dc + 5)) {
                        Helper.sendMessage(target, nick + " successfully " + getActionByType(method).type.actionNamePast.toLowerCase() + " " + defendEvent.triggeringUser + (implementString.equals("") ? "" : " " + implementString) + (defenseItem == null ? "" : " using " + defenseItem.getName(true)) + ". With " + Helper.getNumberPrefix(result) + " " + resultString + " vs " + dcString + " " + nick + " avoided all of the damage!");
                    } else if (result >= dc) {
                        effectiveDamage = (int) Math.max(1, Math.floor(damage / 2d));
                        Helper.sendMessage(target, nick + " managed to partially " + getActionByType(method).type.actionNameWill.toLowerCase() + " " + defendEvent.triggeringUser + (implementString.equals("") ? "" : " " + implementString) + (defenseItem == null ? "" : " using " + defenseItem.getName(true)) + ". With " + Helper.getNumberPrefix(result) + " " + resultString + " vs " + dcString + " " + nick + " only takes half of the " + dec.format(damage) + " damage.");
                    } else {
                        Helper.sendMessage(target, nick + " failed to " + getActionByType(method).type.actionNameWill.toLowerCase() + " " + defendEvent.triggeringUser + (implementString.equals("") ? "" : " " + implementString) + (defenseItem == null ? "" : " using " + defenseItem.getName(true)) + ". With " + Helper.getNumberPrefix(result) + " " + resultString + " vs " + dcString + " " + nick + " takes the full " + dec.format(damage) + " damage.");
                    }
                } else if (defendEvent.type == EventTypes.POTION) {
                    if (result >= dc) {
                        String altTarget = TablesOfRandomThings.getRandomTransformation(true, true, false, true);
                        AppearanceEntry con = PotionHelper.findConsistencyInString(implement);
                        AppearanceEntry app = PotionHelper.findAppearanceInString(implement);
                        String potionString = "";
                        if (app != null && con != null) {
                            System.out.println("App: '" + app.Name + "', Con: '" + con.Name + "'");
                            EffectEntry effectEntry = PotionHelper.getCombinationEffect(con, app);
                            if (effectEntry != null) {
                                String[] prefix = Helper.solvePrefixes(altTarget);
                                if (prefix != null)
                                    altTarget = "the " + prefix[1];
                                String effectString = PotionHelper.replaceParamsInEffectString(effectEntry.effectDrink, altTarget);
                                potionString = " " + effectString.substring(0, 1).toUpperCase() + effectString.substring(1);
                            }
                        }
                        Helper.sendMessage(target, nick + " manages to " + getActionByType(method).type.actionNameWill.toLowerCase() + " the " + defendEvent.implement + " " + defendEvent.triggeringUser + " threw with " + Helper.getNumberPrefix(result) + " " + resultString + " vs " + dcString + ". It splashes onto " + altTarget + " that was standing next to you." + potionString);
                    } else
                        Helper.sendMessage(target, nick + " fails to " + getActionByType(method).type.actionNameWill + " the " + defendEvent.implement + " " + defendEvent.triggeringUser + " threw with " + Helper.getNumberPrefix(result) + " " + resultString + " vs " + dcString + ".");
                } else if (defendEvent.type == EventTypes.FLING) {
                    if (result >= dc + 5) {
                        Helper.sendMessage(target, nick + " successfully " + getActionByType(method).type.actionNamePast.toLowerCase() + " the " + defendEvent.implement + " flung at them by " + defendEvent.triggeringUser + " with " + Helper.getNumberPrefix(result) + " " + resultString + " vs " + dcString + ", avoiding all the damage.");
                    } else if (result >= dc) {
                        effectiveDamage = (int) Math.max(1, Math.floor(damage / 2d));
                        Helper.sendMessage(target, nick + " successfully " + getActionByType(method).type.actionNamePast.toLowerCase() + " the " + defendEvent.implement + " flung at them by " + defendEvent.triggeringUser + " with " + Helper.getNumberPrefix(result) + " " + resultString + " vs " + dcString + ", taking only half of " + dec.format(damage) + " damage.");
                    } else {
                        Helper.sendMessage(target, nick + " fails to " + getActionByType(method).type.actionNameWill.toLowerCase() + " the " + defendEvent.implement + " flung at them by " + defendEvent.triggeringUser + " with " + Helper.getNumberPrefix(result) + " " + resultString + " vs " + dcString + ", taking the full " + dec.format(effectiveDamage) + " damage.");
                    }
                }
            } else {
                Helper.sendMessage(target, "Nothing to defend against right now.", nick);
            }
            return new CommandChainStateObject();
        }
    };
    local_command.setHelpText("Defend against things! Getting stabbed? Things thrown at you? No problem! Just defend! Each action can also be used as an alias which only needs the target (and optionally an item) as arguments.");
    for (Actions action : Actions.values()) {
        if (action.command != null)
            local_command.registerAlias(action.command, action.command);
    }
    debug_command = new Command("defenddebug", new CommandArgumentParser(0, new CommandArgument(ArgumentTypes.STRING, "Action")), Permissions.ADMIN) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String[] params) {
            String action = this.argumentParser.getArgument("Action");
            if (action != null) {
                if ("force".equals(action.toLowerCase()))
                    parseEventQueue();
                return null;
            }
            Helper.sendMessage(target, "Events in queue: " + defendEventLog.size(), nick);
            return new CommandChainStateObject();
        }
    };
}
Also used : DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) GenericMessageEvent(org.pircbotx.hooks.types.GenericMessageEvent) Command(pcl.lc.irc.entryClasses.Command)

Example 24 with GenericMessageEvent

use of org.pircbotx.hooks.types.GenericMessageEvent in project LanteaBot by PC-Logix.

the class DynamicCommands method initHook.

@Override
protected void initHook() {
    Database.addStatement("CREATE TABLE IF NOT EXISTS Commands(command STRING UNIQUE PRIMARY KEY, return, help)");
    Database.addUpdateQuery(5, "ALTER TABLE Commands ADD help STRING DEFAULT NULL NULL;");
    Database.addUpdateQuery(6, "BEGIN TRANSACTION;\n" + "DROP INDEX sqlite_autoindex_Commands_1;\n" + "CREATE TABLE Commands0d9e\n" + "(\n" + "    command STRING PRIMARY KEY,\n" + "    return_value STRING,\n" + "    help STRING DEFAULT NULL\n" + ");\n" + "CREATE UNIQUE INDEX sqlite_autoindex_Commands_1 ON Commands0d9e (command, return_value);\n" + "INSERT INTO Commands0d9e(command, return_value, help) SELECT command, return, help FROM Commands;\n" + "DROP TABLE Commands;\n" + "ALTER TABLE Commands0d9e RENAME TO Commands;\n" + "COMMIT;");
    Database.addPreparedStatement("addCommand", "INSERT OR REPLACE INTO Commands(command, return_value) VALUES (?, ?);");
    Database.addPreparedStatement("addCommandHelp", "UPDATE Commands SET help = ? WHERE command = ?");
    Database.addPreparedStatement("searchCommands", "SELECT command, help, return_value FROM Commands");
    Database.addPreparedStatement("getCommand", "SELECT return_value, help FROM Commands WHERE command = ?");
    Database.addPreparedStatement("delCommand", "DELETE FROM Commands WHERE command = ?;");
    Database.addPreparedStatement("getCommands", "SELECT * FROM Commands");
    InputStream luain = getClass().getResourceAsStream("/jnlua/luasb.lua");
    try {
        luasb = CharStreams.toString(new InputStreamReader(luain, Charsets.UTF_8));
    } catch (IOException e2) {
        e2.printStackTrace();
    }
    initLua();
    toggle_command = new Command("dyncmd", new CommandRateLimit(10), Permissions.MOD) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            if (params.equals("disable") || params.equals("enable")) {
                Helper.toggleCommand("dyncmd", target, params);
            } else {
                String isEnabled = Helper.isEnabledHere(target, "dyncmd") ? "enabled" : "disabled";
                Helper.sendMessage(target, "dyncmd is " + isEnabled + " in this channel", nick);
            }
            return new CommandChainStateObject();
        }
    };
    toggle_command.setHelpText("Dynamic command module");
    IRCBot.registerCommand(toggle_command);
    try {
        PreparedStatement searchCommands = Database.getPreparedStatement("searchCommands");
        ResultSet commands = searchCommands.executeQuery();
        while (commands.next()) {
            if (commands.getString(2) != null) {
                registerDynamicCommand(commands.getString(1), commands.getString(2));
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        IRCBot.log.info("An error occurred while processing this command");
    }
    // <editor-fold desc="Alias into proper command sub-command structure">
    base_command = new Command("command", Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            Helper.sendMessage(target, this.trySubCommandsMessage(params), nick);
            return new CommandChainStateObject();
        }
    };
    add = new Command("add", new CommandArgumentParser(2, new CommandArgument(ArgumentTypes.STRING, "Command"), new CommandArgument(ArgumentTypes.STRING, "Content")), Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            String cmd = this.argumentParser.getArgument("Command");
            String content = this.argumentParser.getArgument("Content");
            if (!IRCBot.dynamicCommands.containsKey(cmd)) {
                DbCommand item = new DbCommand(cmd, content, null);
                item.Save();
                event.respond("Command Added! Don't forget to set help text with " + Config.commandprefix + base_command.getCommand() + " " + addhelp.getCommand() + "!");
                registerDynamicCommand(cmd, content);
            } else {
                event.respond("Can't override existing commands.");
            }
            return new CommandChainStateObject();
        }
    };
    add.setHelpText("Adds a dynamic command.");
    del = new Command("del", new CommandArgumentParser(1, new CommandArgument(ArgumentTypes.STRING, "Command")), Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            String cmd = this.argumentParser.getArgument("Command");
            DbCommand item = DbCommand.GetByCommand(cmd);
            if (item != null) {
                item.Delete();
                event.respond("Command deleted");
                IRCBot.unregisterCommand(cmd);
            } else {
                event.respond("Unable to find command '" + cmd + "'");
            }
            return new CommandChainStateObject();
        }
    };
    del.registerAlias("delete");
    del.registerAlias("rem");
    del.registerAlias("remove");
    del.setHelpText("Removes a dynamic command.");
    addhelp = new Command("addhelp", new CommandArgumentParser(2, new CommandArgument(ArgumentTypes.STRING, "Command"), new CommandArgument(ArgumentTypes.STRING, "Text")), Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) throws Exception {
            PreparedStatement addCommandHelp = Database.getPreparedStatement("addCommandHelp");
            String theCommand = this.argumentParser.getArgument("Command");
            String theHelp = this.argumentParser.getArgument("Text");
            if (IRCBot.dynamicCommands.containsKey(theCommand)) {
                try {
                    addCommandHelp.setString(1, theHelp);
                    addCommandHelp.setString(2, theCommand.toLowerCase());
                    addCommandHelp.executeUpdate();
                    IRCBot.dynamicCommands.get(theCommand).setHelpText(theHelp);
                    event.respond("Help Set");
                } catch (SQLException e) {
                    e.printStackTrace();
                    event.respond("fail 1");
                }
            } else {
                event.respond("fail 2 ");
            }
            return new CommandChainStateObject();
        }
    };
    addhelp.registerAlias("sethelp");
    addhelp.registerAlias("help");
    addhelp.setHelpText("Sets help on dynamic commands");
    print = new Command("print", new CommandArgumentParser(1, new CommandArgument(ArgumentTypes.STRING, "Command")), Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) throws Exception {
            try {
                String cmd = this.argumentParser.getArgument("Command");
                PreparedStatement getCommand = Database.getPreparedStatement("getCommand");
                getCommand.setString(1, cmd);
                ResultSet command1 = getCommand.executeQuery();
                if (command1.next()) {
                    String message = command1.getString(1);
                    Helper.sendMessage(target, message);
                    if (!IRCBot.commands.containsKey(cmd))
                        Helper.sendMessage(target, "Command is not registered!");
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return new CommandChainStateObject();
        }
    };
    edit = new Command("edit", new CommandArgumentParser(2, new CommandArgument(ArgumentTypes.STRING, "Command"), new CommandArgument(ArgumentTypes.STRING, "Content")), Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) throws Exception {
            PreparedStatement addCommand = Database.getPreparedStatement("addCommand");
            PreparedStatement getCommand = Database.getPreparedStatement("getCommand");
            String cmd = this.argumentParser.getArgument("Command").toLowerCase();
            String content = this.argumentParser.getArgument("Content");
            String[] message = params.split(" ", 2);
            getCommand.setString(1, cmd);
            ResultSet command1 = getCommand.executeQuery();
            if (command1.next()) {
                IRCBot.unregisterCommand(cmd);
                addCommand.setString(1, cmd);
                addCommand.setString(2, content);
                addCommand.executeUpdate();
                unregisterDynamicCommand(cmd);
                registerDynamicCommand(cmd, content);
                event.respond("Command Edited");
            } else {
                event.respond("Can't add new commands with edit!");
            }
            return new CommandChainStateObject();
        }
    };
    edit.registerAlias("update");
    edit.registerAlias("change");
    edit.registerAlias("set");
    alias = new Command("alias", Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            Helper.sendMessage(target, "To add an alias create a dynamic command with one or more commands to execute between two % like %command%.");
            return new CommandChainStateObject();
        }
    };
    placeholders = new Command("placeholders", Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            Helper.sendMessage(target, "Valid placeholders: %command% - Where 'command' is a different dyn-command. [randomitem] - Inserts a random item from the inventory. [drama] - ??. [argument] - The entire argument string. [nick] - The name of the caller. {n} - Where n is the number of an argument word starting at 0.");
            return new CommandChainStateObject();
        }
    };
    prefixes = new Command("prefixes", Permissions.TRUSTED) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) {
            Helper.sendMessage(target, "Valid prefixes: [js] - Attempts to parse the dyn-command contents as javascript. [lua] - Attempts to parse the dyn-command contents as Lua. [action] - Sends an ACTION instead of a normal message.");
            return new CommandChainStateObject();
        }
    };
    base_command.registerSubCommand(add);
    base_command.registerSubCommand(del);
    base_command.registerSubCommand(addhelp);
    base_command.registerSubCommand(print);
    base_command.registerSubCommand(edit);
    base_command.registerSubCommand(placeholders);
    base_command.registerSubCommand(prefixes);
    IRCBot.registerCommand(base_command);
    // </editor-fold>
    dynamicCommands = new ArrayList<>();
    try {
        PreparedStatement getCommands = Database.getPreparedStatement("getCommands");
        ResultSet resultSet = getCommands.executeQuery();
        int count = 0;
        while (resultSet.next()) {
            count++;
            registerDynamicCommand(resultSet.getString("command"), resultSet.getString("return_value"), resultSet.getString("help"));
        }
        System.out.println("Registered " + count + " dyn command" + (count == 1 ? "" : "s"));
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : SQLException(java.sql.SQLException) PreparedStatement(java.sql.PreparedStatement) GenericMessageEvent(org.pircbotx.hooks.types.GenericMessageEvent) LuaException(com.naef.jnlua.LuaException) SQLException(java.sql.SQLException) ScriptException(javax.script.ScriptException) DbCommand(pcl.lc.utils.db_items.DbCommand) DbCommand(pcl.lc.utils.db_items.DbCommand) ResultSet(java.sql.ResultSet)

Example 25 with GenericMessageEvent

use of org.pircbotx.hooks.types.GenericMessageEvent in project LanteaBot by PC-Logix.

the class AnimalFacts method initCommands.

private void initCommands() {
    local_command = new Command("catfact") {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) throws IOException, JSONException {
            JSONObject json = readJsonFromUrl("https://some-random-api.ml/animal/cat");
            Helper.sendMessage(target, json.get("fact").toString());
            return new CommandChainStateObject();
        }
    };
    local_command2 = new Command("fact", new CommandArgumentParser(0, new CommandArgument(ArgumentTypes.STRING, "Animal"))) {

        @Override
        public CommandChainStateObject onExecuteSuccess(Command command, String nick, String target, GenericMessageEvent event, String params) throws IOException, JSONException {
            List<String> animalNames = Arrays.asList("dog", "cat", "panda", "fox", "red_panda", "koala", "birb", "racoon", "kangaroo");
            String aminal = this.argumentParser.getArgument("Animal");
            if (aminal == null || aminal.equals("random") || aminal.equals("")) {
                Random rand = new Random();
                aminal = animalNames.get(rand.nextInt(animalNames.size()));
            }
            if (aminal.equals("bird")) {
                // Cause this API is dumb. *sigh*
                aminal = "birb";
            } else if (aminal.equals("red panda")) {
                aminal = "red_panda";
            }
            if (animalNames.contains(aminal)) {
                JSONObject json = readJsonFromUrl("https://some-random-api.ml/animal/" + aminal);
                Helper.sendMessage(target, aminal.substring(0, 1).toUpperCase() + aminal.substring(1) + " fact: " + json.get("fact").toString());
            } else {
                Helper.sendMessage(target, "Not a valid option. " + String.join(", ", animalNames));
            }
            return new CommandChainStateObject();
        }
    };
    local_command.registerAlias("catfacts");
    local_command.setHelpText("Cat Facts!");
    local_command2.setHelpText("Animal facts!");
}
Also used : JSONObject(org.json.JSONObject) Random(java.util.Random) Command(pcl.lc.irc.entryClasses.Command) CommandArgument(pcl.lc.irc.entryClasses.CommandArgument) JSONException(org.json.JSONException) CommandChainStateObject(pcl.lc.utils.CommandChainStateObject) CommandArgumentParser(pcl.lc.irc.entryClasses.CommandArgumentParser) List(java.util.List) IOException(java.io.IOException) GenericMessageEvent(org.pircbotx.hooks.types.GenericMessageEvent)

Aggregations

GenericMessageEvent (org.pircbotx.hooks.types.GenericMessageEvent)73 CommandChainStateObject (pcl.lc.utils.CommandChainStateObject)58 Command (pcl.lc.irc.entryClasses.Command)51 CommandArgument (pcl.lc.irc.entryClasses.CommandArgument)34 CommandArgumentParser (pcl.lc.irc.entryClasses.CommandArgumentParser)34 PreparedStatement (java.sql.PreparedStatement)15 ResultSet (java.sql.ResultSet)15 ArrayList (java.util.ArrayList)9 IOException (java.io.IOException)8 SimpleDateFormat (java.text.SimpleDateFormat)5 Date (java.util.Date)5 MessageEvent (org.pircbotx.hooks.events.MessageEvent)5 PrivateMessageEvent (org.pircbotx.hooks.events.PrivateMessageEvent)5 SQLException (java.sql.SQLException)4 DecimalFormat (java.text.DecimalFormat)4 CommandRateLimit (pcl.lc.irc.entryClasses.CommandRateLimit)4 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)3 JSONException (org.json.JSONException)3 User (org.pircbotx.User)3 InetAddress (java.net.InetAddress)2