public static void main(String[] args) throws Exception
	{
		loadAll();
		
		String source = "EidanSp/dota";
		boolean findTopics = true;
		long curTime = System.currentTimeMillis();
		long refreshRate = 300000; // 300k ms is 5 minutes
		DotaBot bot = new DotaBot();
			
		connect(bot);
		
		//TwitterClient client = new TwitterClient(new TwitterFactory().getInstance(), bot);
		ConfigurationBuilder cb = new ConfigurationBuilder();
		cb.setDebugEnabled(true)
		  .setOAuthConsumerKey("GDUOSgzLQ3DR7SaBTLTHQ")
		  .setOAuthConsumerSecret("pFN939TmUWIqglBq0HVOZH1D41F1FkjZw3RGT11zaGE")
		  .setOAuthAccessToken("370878274-qnoOtbmKbgtWfMzjYuNGB7rmvAicOxXFEPiZvWc5")
		  .setOAuthAccessTokenSecret("m7xJ8Zw2IafsWSFuSLMo3JWg0wCL8oq59LlOAteq8");
		TwitterFactory tf = new TwitterFactory(cb.build());
		Twitter twitter = tf.getInstance();
		
		TwitterClient client = new TwitterClient(twitter, bot);
		
		while(true)
		{					
			if(findTopics)
			{
				try {
				getTopics(bot); }
				catch(Exception e)
				{
					bot.output(CHANNEL, "Couldn't open website");
					System.out.println("Couldn't open website");
					e.printStackTrace();
				}
				finally {
				findTopics = false;			
				}
			}
			
			if(Math.abs(System.currentTimeMillis() - curTime) > 10000)
				findTopics = true;
			

			client.getTimeline(source);
			TwitterUtils.sleep(refreshRate);
			
			if(!bot.isConnected()) {
				System.out.println("Bot isn't connected... attemping to reconnect");
				connect(bot);
			}
			boolean found = false;
			String[] channels = bot.getChannels();
			for(String channel : channels) {
				System.out.println(channel);
				if(channel.equalsIgnoreCase(CHANNEL)) {
					found = true;
					break;
				}
			}
			
			if(!found) {
				bot.joinChannel(CHANNEL);
			}
		}		
	}