Libraryless. Click here for Pure Java version (1857L/12K/41K).
1 | !747 |
2 | |
3 | m { |
4 | static new L<OK> entries; |
5 | |
6 | static class OK { |
7 | S userLine; |
8 | long date; |
9 | S user; |
10 | L<S> dialogHistory; |
11 | S botID; |
12 | S computerID; |
13 | } |
14 | |
15 | p { |
16 | readLocally("entries"); |
17 | print("Entries in my database: " + entries.size()); |
18 | makeAndroid("OK Collector Bot."); |
19 | } |
20 | |
21 | static synchronized S answer(S s) { |
22 | new Matches m; |
23 | |
24 | if (match3("New entry. user line: *, date: *, user: *, botID: *, computerID: *, dialog history: *", s, m)) { |
25 | new OK x; |
26 | x.userLine = unquote(m.m[0]); |
27 | x.date = parseLong(unquote(m.m[1])); |
28 | x.user = unquote(m.m[2]); |
29 | x.botID = unquote(m.m[3]); |
30 | x.computerID = unquote(m.m[4]); |
31 | try { |
32 | x.dialogHistory = (List) unstructure(unquote(m.m[5])); |
33 | } catch (RuntimeException e) { |
34 | print("oops: " + m.m[5]); |
35 | } |
36 | entries.add(x); |
37 | saveLocally("entries"); |
38 | return "OK, now " + entries.size() + " entries."; |
39 | } |
40 | |
41 | return standardQuery(s, "entries"); |
42 | } |
43 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001245 |
Snippet name: | OK Collector Bot (LIVE) |
Eternal ID of this version: | #1001245/1 |
Text MD5: | 28e7be1d0ce60066f74e14d328dea613 |
Transpilation MD5: | 8996d30c338be501f9aec760b98fa2ab |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-11-13 18:05:46 |
Source code size: | 1034 bytes / 43 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 671 / 1009 |
Referenced in: | [show references] |