Alright, so I am getting the messages perfectly from the Twitch Server, but when I go to section them off the bot crashes. This is the code I read the messages from, and this is very important to myself in order to make the bot function dynamically.
public static void handleLine(String line) throws IOException { if (line == null) {throw new IllegalArgumentException("Can't process null line");} while ((line = in.readLine()) != null) { log("<<<" + line); if (line.startsWith("PING")) { sendRawLine(line.replace("PING", "PONG")); } String[] args = line.split(":"); String command = args[2]; // Line where it goes wrong. if(command.contains("test")) { sendMessage("#peacebot","testing"); } } } }
I would appreciate it if anyone could help me with this, because I am rather new to Java but I am not new to IRC.