public void onTrigger( String channel, String sender, String login, String hostname, String message, String trigger) { String toNick = null; String msg = null; try { toNick = message.substring(0, message.indexOf(' ')); msg = message.substring(message.indexOf(' ')); } catch (IndexOutOfBoundsException ioobe) { bot.msg(channel, "Bogus message format: try !" + TRIGGER + " <nick> <message>."); return; } for (User user : bot.getUsers(channel)) { if (user.equals(toNick)) { bot.msg(channel, toNick + " is here right now, you dumbass!"); return; } } saveTell(channel, sender, toNick, msg); }
public void onMessage( String channel, String sender, String login, String hostname, String message) { if (message.matches("^(\\w+):.+") && !message.matches("(\\w+)://.+")) { String toNick = message.substring(0, message.indexOf(':')); String msg = message.substring(message.indexOf(':') + 1, message.length()); List<SeenUser> seens = JWorm.get(SeenUser.class); boolean save = false; for (SeenUser s : seens) { if (s.getNicks().contains(toNick)) { save = true; break; } } for (User user : bot.getUsers(channel)) { if (user.equals(toNick)) { return; } } if (save) { saveTell(channel, sender, toNick, msg); } } }
public void onNickChange(String oldNick, String login, String hostname, String newNick) { for (String chan : bot.getChannels()) { for (User user : bot.getUsers(chan)) { if (user.equals(newNick)) { tell(chan, newNick); } } } }