public class Bot {
public static void main(String[] args) throws Exception {
<<<<<<< HEAD
// Bot Configuration
LocalConfiguration localConfig = ConfigurationManager.loadConfig();
CommandProcessor processor = new CommandProcessor(localConfig.trigger);
ProfileManager profiles = new ProfileManager(DBConnection.getProfileModel());
DateTimeCommand dtCmd = new DateTimeCommand();
// Commands
processor.register("rand", new RandCommand());
processor.register("time", dtCmd);
processor.register("date", dtCmd);
processor.register("datetime", dtCmd);
processor.register("lart", new LartCommand());
processor.register("killertrout", new KillerTroutCommand());
processor.register("joins", new JoinsCommand());
processor.register("calc", new CalcCommand());
processor.register("karma", new KarmaCommand());
processor.register("profile", new ProfileCommand(profiles));
processor.register("help", new HelpCommand(processor));
processor.register("nick", new NickCommand());
processor.register("factoid", new FactoidCommand(DBConnection.getFactoidModel()));
processor.register("github", new GithubCommand());
// Configure bot
Builder cb = new Configuration.Builder()
.setName(localConfig.nick)
.setAutoNickChange(true)
.setAutoReconnect(true)
.setServer(localConfig.host, localConfig.port)
.addAutoJoinChannel("unity-coders")
.addListener(new CommandListener(processor))
.addListener(new LinesListener())
.addListener(JoinsListener.getInstance());
// Configure SSL
if (localConfig.ssl)
cb.setSocketFactory(SSLSocketFactory.getDefault());
// Add channels to join
for (String channel : localConfig.channels)
{
cb.addAutoJoinChannel(channel);
=======
String configPath = ConfigurationManager.JSON_FILE_NAME;
if (args.length > 1) {
configPath = args[1];
>>>>>>> 26691d76bb08a197b20b133efa9a8ed501192e3b
}
BotRunnable runnable = new BotRunnable(ConfigurationManager.loadConfig(configPath)); |