package io.github.likcoras.ssbot;

import io.github.likcoras.ssbot.backends.BttHandler;
import io.github.likcoras.ssbot.backends.DbHandler;
import io.github.likcoras.ssbot.backends.MuHandler;
import io.github.likcoras.ssbot.backends.XmlHandler;

public class SSBot {
	
	public static void main(final String[] args) {
		
		final ConfigParser cfg = new ConfigParser();
		cfg.parse();
		
		System.out.println("Loading database backend...");
		final DbHandler db = new DbHandler(cfg);
		
		System.out.println("Loading mangaupdates backend...");
		final MuHandler mu = new MuHandler(cfg);
		
		System.out
				.println("Loading xml backend...(Fetching the xml file from another thread)");
		final XmlHandler xml = new XmlHandler(cfg);
		xml.scheduleUpdate();
		
		System.out.println("Loading batoto backend...");
		final BttHandler bt = new BttHandler(cfg);
		
		System.out.println("Starting bot...");
		new BotManager(cfg, db, mu, xml, bt).start();
		
		System.out.println("Bye!");
		System.exit(0);
		
	}
	
}

@@ -39,53 +39,163 @@
 ort 
-io.github.likcoras.ssbot.backends.BttHandler;
+java.io.IOException;%0A%0Aimport javax.xml.parsers.ParserConfigurationException;%0A%0Aimport org.pircbotx.exception.IrcException;%0Aimport org.xml.sax.SAXException;%0A
 %0Aimp
@@ -232,18 +232,19 @@
 ackends.
-Db
+Btt
 Handler;
@@ -495,88 +495,75 @@
 %09%0A%09%09
-System.out.println(%22Loading database backend...%22);%0A%09%09final Db
+BotManager bot = new BotManager(cfg);%0A%09%09bot.register
 Handler
- db = 
+(
 new 
-Db
+Btt
 Hand
@@ -574,93 +574,49 @@
 cfg)
+)
 ;%0A%09%09%0A%09%09
-System.out.println(%22Loading mangaupdates backend...%22);%0A%09%09final Mu
+try %7B%0A%09%09%09%0A%09%09%09bot.register
 Handler
- mu = 
+(
 new 
@@ -633,117 +633,95 @@
 cfg)
+)
 ;%0A%09%09
+%09
 %0A%09%09
-System.out%0A%09%09%09%09.println(%22Loading xml backend...(Fetching the xml file from another thread)%22);%0A%09%09final 
+%7D catch (ClassNotFoundException e) %7B%0A%09%09%09%0A%09%09%09e.printStackTrace();%0A%09%09%09%0A%09%09%7D%0A%09%09%0A%09%09
 XmlH
@@ -760,21 +760,29 @@
 ;%0A%09%09
-xml.scheduleU
+%0A%09%09try %7B%0A%09%09%09%0A%09%09%09xml.u
 pdat
@@ -792,99 +792,145 @@
 ;%0A%09%09
+%09
 %0A%09%09
-System.out.println(%22Loading batoto backend...%22);%0A%09%09final BttHandler bt = new Btt
+%7D catch (IOException %7C SAXException %7C ParserConfigurationException e) %7B%0A%09%09%09%0A%09%09%09e.printStackTrace();%0A%09%09%09%0A%09%09%7D%0A%09%09%0A%09%09bot.register
 Handler(
 cfg)
@@ -925,27 +925,27 @@
 Handler(
-cfg
+xml
 );%0A%09%09%0A%09%09
 System.o
@@ -940,127 +940,111 @@
 %09%0A%09%09
-System.out.println(%22Starting bot...%22);%0A%09%09new BotManager(cfg, db, mu, xml, bt).start();%0A
+try %7B%0A%09%09%09bot.start();%0A%09%09%7D catch (IOException %7C IrcException e) %7B%0A%09
 %09%09%0A%09%09
+%09
-System.out.println(%22Bye!%22);
+e.printStackTrace();%0A%09%09%09%0A%09%09%7D%0A%09%09
 %0A%09%09S

Implement changes