!747 !pcall { m { static S myName = "Leo Bot"; static int delay = 5000; static new L history; p { while (true) { pcall { // make sure we stay runnning if connection fails or error for (ChatLine l : suckHumans(myName)) { historyAdd(l.text); S bla = structure(history.subList(Math.max(0, history.size()-3), history.size())); S answer = sendToRemoteBot("Leo Bot", "!" + bla); print("Leo's answer: " + answer); if (answer != null && !answer.equals(history.get(history.size()-1)) && !answer.equals("?")) { sayInWebChat(myName, answer); historyAdd(answer); } } } sleep(delay); } } static void historyAdd(S line) { history.add(line); while (history.size() > 3) history.remove(0); } }