Libraryless. Click here for Pure Java version (1832L/12K/40K).
1 | !747 |
2 | |
3 | m {
|
4 | static new Map<S, Long> lastSeen; // computer ID to timestamp |
5 | |
6 | p {
|
7 | readLocally("lastSeen");
|
8 | makeAndroid3("Who Is Online Bot.");
|
9 | } |
10 | |
11 | static synchronized S answer(S s) {
|
12 | new Matches m; |
13 | if (match3("I am online. -*", s, m)) {
|
14 | S computerID = m.unq(0); |
15 | lastSeen.put(computerID, now()); |
16 | saveLocally("lastSeen");
|
17 | print("Got ping from " + computerID + ".");
|
18 | ret "OK, noted."; |
19 | } |
20 | |
21 | if (match3("When was * last online?", s, m)) {
|
22 | Long time = lastSeen.get(m.unq(0)); |
23 | ret time != null ? format3("at *", time) : "never";
|
24 | } |
25 | |
26 | ret standardQuery(s, "lastSeen"); |
27 | } |
28 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1001768 |
| Snippet name: | Who Is Online Bot |
| Eternal ID of this version: | #1001768/1 |
| Text MD5: | 84e7d3c04db42f27e17c7cf839074b0d |
| Transpilation MD5: | e3e3a783adb6bec4e2e8e351886fc1ad |
| Author: | stefan |
| Category: | |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-11-13 17:22:57 |
| Source code size: | 677 bytes / 28 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 922 / 1202 |
| Referenced in: | [show references] |