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
Snippet ID: | #1002356 |
Snippet name: | Store messages bot |
Eternal ID of this version: | #1002356/1 |
Text MD5: | 00707ecb99cf1c4f37125fd7e8066388 |
Transpilation MD5: | 69f2caf0c62d1c9fd01eefe730cc8a54 |
Author: | bgrgndz |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-01-15 22:37:02 |
Source code size: | 1191 bytes / 53 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 948 / 1339 |
Referenced in: | [show references] |