Package com.zack6849.alphabot.api

Examples of com.zack6849.alphabot.api.Config


            String seperator = "+" + StringUtils.repeat('-', 16) + "+" + StringUtils.repeat('-', 51) + "+" + StringUtils.repeat('-', 51) + "+";
            event.getUser().send().notice(seperator);
            event.getUser().send().notice(header);
            event.getUser().send().notice(seperator);
            for (String s : CommandRegistry.commands.keySet()) {
                Command command = CommandRegistry.getCommand(s);
                event.getUser().send().notice(String.format("| %s| %s| %s|", StringUtils.rightPad(command.getName(), 15), StringUtils.rightPad(command.getDescription(), 50), StringUtils.rightPad(command.getHelp(), 50)));
            }
            event.getUser().send().notice(seperator);
            return true;
        }
        if (args.length == 2) {
            Command command = CommandRegistry.getCommand(StringUtils.capitalize(args[1].toLowerCase()));
            if (command != null) {
                event.getUser().send().notice(String.format("Help for command: %s - %s - %s", command.getName(), command.getDescription(), command.getHelp()));
            } else {
                event.getUser().send().notice("Could not find the command " + args[1] + ", are you sure you spelled it right?");
            }
            return true;
        }
View Full Code Here


            config.load();
            manager.load();
            Reflections reflections = new Reflections("com.zack6849.alphabot.commands");
            Set<Class<? extends Command>> subTypes = reflections.getSubTypesOf(Command.class);
            for (Class c : subTypes) {
                Command cmd = CommandRegistry.getCommand(c.getSimpleName());
                cmd.setManager(manager);
                cmd.setConfig(config);
                CommandRegistry.register(cmd);
            }
            //i have no idea what this is, but IDEA wouldn't shut the fuck up about changing it.
            Configuration.Builder<PircBotX> builder = new Configuration.Builder<PircBotX>();
            builder.setName(config.getBotNickname());
View Full Code Here

        System.setProperty(SimpleLogger.LEVEL_IN_BRACKETS_KEY, "true");
        System.setProperty(SimpleLogger.SHOW_LOG_NAME_KEY, "false");
        System.out.println("Starting");
        try {
            startup = System.currentTimeMillis();
            final Config config = new Config();
            PermissionManager manager = new PermissionManager();
            System.out.println("Loading and registering commands");
            config.load();
            manager.load();
            Reflections reflections = new Reflections("com.zack6849.alphabot.commands");
            Set<Class<? extends Command>> subTypes = reflections.getSubTypesOf(Command.class);
            for (Class c : subTypes) {
                Command cmd = CommandRegistry.getCommand(c.getSimpleName());
                cmd.setManager(manager);
                cmd.setConfig(config);
                CommandRegistry.register(cmd);
            }
            //i have no idea what this is, but IDEA wouldn't shut the fuck up about changing it.
            Configuration.Builder<PircBotX> builder = new Configuration.Builder<PircBotX>();
            builder.setName(config.getBotNickname());
            builder.setRealName(config.getBotUsername());
            builder.setLogin(config.getBotIdent());
            builder.setFinger(config.getCtcpFinger());
            builder.setEncoding(Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset());
            builder.setNickservPassword(config.getBotPassword());
            builder.setVersion("Alphbot v2.0 BETA");
            builder.setAutoNickChange(config.isAutoNickChange());
            builder.setAutoReconnect(config.isAutoReconnectServer());
            builder.setServer(config.getServerHostame(), Integer.parseInt(config.getServerPort()), config.getServerPassword());
            builder.getListenerManager().addListener(new com.zack6849.alphabot.listeners.MessageEvent(config, manager));
            builder.getListenerManager().addListener(new com.zack6849.alphabot.listeners.InviteEvent(config, manager));
            for (String channel : config.getChannels()) {
                builder.addAutoJoinChannel(channel);
            }
            PircBotX bot = new PircBotX(builder.buildConfiguration());
            System.out.println("Starting bot...");
            if (config.isEnableChatSocket()) {
                new Thread(new ChatSocketListener(bot, config)).start();
            }
            bot.startBot();
            System.out.println("Shutting down");
            System.exit(0);
View Full Code Here

    @Override
    public boolean execute(MessageEvent event) {
        event.getChannel().send().message("Test!");
        event.getChannel().send().message("User Level : " + event.getUser().getUserLevels(event.getChannel()).toString());
        event.getChannel().send().message("Group: " + manager.getUserGroup(event.getUser()).getName());
        Group g = manager.getUserGroup(event.getUser());
        return true;
    }
View Full Code Here

        System.setProperty(SimpleLogger.SHOW_LOG_NAME_KEY, "false");
        System.out.println("Starting");
        try {
            startup = System.currentTimeMillis();
            final Config config = new Config();
            PermissionManager manager = new PermissionManager();
            System.out.println("Loading and registering commands");
            config.load();
            manager.load();
            Reflections reflections = new Reflections("com.zack6849.alphabot.commands");
            Set<Class<? extends Command>> subTypes = reflections.getSubTypesOf(Command.class);
            for (Class c : subTypes) {
                Command cmd = CommandRegistry.getCommand(c.getSimpleName());
                cmd.setManager(manager);
View Full Code Here

                builder.addAutoJoinChannel(channel);
            }
            PircBotX bot = new PircBotX(builder.buildConfiguration());
            System.out.println("Starting bot...");
            if (config.isEnableChatSocket()) {
                new Thread(new ChatSocketListener(bot, config)).start();
            }
            bot.startBot();
            System.out.println("Shutting down");
            System.exit(0);
        } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of com.zack6849.alphabot.api.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.