Libraryless. Click here for Pure Java version (2293L/14K/49K).
!752 static new MultiMap<S, Line> map; static class Line { S text; S timestamp; Line(){ } *(S *text, S *timestamp) {} } p{ makeBot("Store messages bot"); load("map"); } synchronized answer{ S username = ""; if(getUserName() == null){ username = "anonymous"; }else{ username = getUserName(); } if(matchStart("list all messages from *", s, m)){ ret structure(map.get(m.unq(0))); } if(match("list all users", s)){ ret structure(map.keySet()); } if(matchStart("did * say something about *", s, m)){ if(map.containsKey(m.unq(0))){ List<Line> list = map.get(m.unq(0)); int times = 0; L<S> lolist = new L; for (int i = l(list)-1; i >= 0; i--) { if(list.get(i).text.contains(m.unq(1))){ times = times + 1; lolist.add(list.get(i).text); } } if (times == 0){ ret "no results found"; }else{ ret lolist + "\n" + times +" results found"; } }else{ ret m.unq(0) + " did not say anything."; } } Line line = new Line(s,getSlackTS()); map.put(username, line); save("map"); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment