package com.mjoell.twitchchatcounter;

import java.sql.SQLException;

import org.jibble.pircbot.PircBot;

import com.mjoell.twitchchatcounter.TwitchChatCounter;

public class IRCBot extends PircBot {
	public static String topChatter;
	
	public IRCBot() {
		this.setName(TwitchChatCounter.username);
	}
	
	public void onMessage(String channel, String sender, String login, String hostname, String message) {
		try {
			if(!sender.toLowerCase().equals("nightbot") || !sender.toLowerCase().equals("moobot")) {
				Mysql.addOneForUserInChannel(channel.replace("#", ""), sender);
			}
		} catch (SQLException e) {
			System.out.println(e.getStackTrace());
		}
		
		if(sender.toLowerCase().equals("pirateeeeeee") && message.toLowerCase().equals("uberfacts, topchatter")) {
			String topChatter = null;
			try {
				topChatter = Mysql.getTopChatterInChannel(TwitchChatCounter.channel.replace("#", ""));
			} catch(SQLException e) {
				System.out.println(e.getStackTrace());
			}
			sendMessage(TwitchChatCounter.channel, topChatter);
		}
		
		if(sender.toLowerCase().equals("pirateeeeeee") && message.toLowerCase().equals("uberfacts, top10chatters")) {
			String topChatter = null;
			try {
				topChatter = Mysql.getTopTenChatterInChannel(TwitchChatCounter.channel.replace("#", ""));
			} catch(SQLException e) {
				System.out.println(e.getStackTrace());
			}
			sendMessage(TwitchChatCounter.channel, topChatter);
		}
		
		String[] CommonEmotes = new String[]{"KappaHD", "FrankerZ", "Keppo", "PJSalt", "Kappa", "Kreygasm", "SwiftRage", "FailFish", "PogChamp"};
		
		for(int i = 0; i < CommonEmotes.length; i++) {
			if(message.contains(CommonEmotes[i])) {
				try {
					Mysql.addOneEmoteForChannel(CommonEmotes[i], channel);
				} catch (SQLException e) {
					System.out.println(e.getStackTrace());
				}
			}
		}
	}
}
@@ -605,39 +605,22 @@
 e) %7B%0A%09%09%09
-System.out.println(e.ge
+e.prin
 tStackTr
@@ -620,25 +620,24 @@
 StackTrace()
-)
 ;%0A%09%09%7D%0A%09%09%0A%09%09i
@@ -904,39 +904,22 @@
 ) %7B%0A%09%09%09%09
-System.out.println(e.ge
+e.prin
 tStackTr
@@ -915,33 +915,32 @@
 rintStackTrace()
-)
 ;%0A%09%09%09%7D%0A%09%09%09sendMe
@@ -1269,39 +1269,22 @@
 ) %7B%0A%09%09%09%09
-System.out.println(e.ge
+e.prin
 tStackTr
@@ -1284,25 +1284,24 @@
 StackTrace()
-)
 ;%0A%09%09%09%7D%0A%09%09%09se
@@ -1702,31 +1702,14 @@
 %09%09%09%09
-System.out.println(e.ge
+e.prin
 tSta
@@ -1717,17 +1717,16 @@
 kTrace()
-)
 ;%0A%09%09%09%09%7D%0A

change stacktrace output