public void onPrivateMessage(String sender, String login, String hostname, String message) { if (sender.equals("mafiozi") && message.contains("Current Players:")) { System.out.println("PM for required action"); // get a random number String playerNumber = processPlayersList(Colors.removeFormattingAndColors(message)); // now choose a command String action = processActionList(Colors.removeFormattingAndColors(message)); bot.Message("mafiozi", action + " " + playerNumber); } }
public void onMessage( String channel, String sender, String login, String hostname, String message) { if (channel.equals("#mafiozi")) { if (message.startsWith("!reg") && !inGame) { bot.Message(channel, "!reg"); inGame = true; bot.Message("mafiozi", "!ide BOB bobspassword"); } else if (inGame && sender.equals("mafiozi")) { if (message.contains("The End!") || message.contains("Cast:")) { clear(); } else if (message.toLowerCase().contains(bot.Nick()) && message.toLowerCase().contains("killed")) { clear(); } else if (message.contains("!yes")) { if (!message.contains(bot.Nick())) { bot.Message(channel, "!yes"); } else { bot.Message(channel, "!no"); } voted = false; } else if (message.contains("Current Players:")) { processPlayersList(Colors.removeFormattingAndColors(message)); } else if (message.contains("Who is accused?") && !voted) { if (numberList == null) return; String number = numberList.get(r.nextInt(numberList.size())); bot.Message(channel, "!" + number); voted = true; } } } }