Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

43
LINES

< > BotCompany Repo | #1001245 // OK Collector Bot (LIVE)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1857L/12K/41K).

!747

m {
  static new L<OK> entries;
  
  static class OK {
    S userLine;
    long date;
    S user;
    L<S> dialogHistory;
    S botID;
    S computerID;
  }
  
  p {
    readLocally("entries");
    print("Entries in my database: " + entries.size());
    makeAndroid("OK Collector Bot.");
  }
  
  static synchronized S answer(S s) {
    new Matches m;
    
    if (match3("New entry. user line: *, date: *, user: *, botID: *, computerID: *, dialog history: *", s, m)) {
      new OK x;
      x.userLine = unquote(m.m[0]);
      x.date = parseLong(unquote(m.m[1]));
      x.user = unquote(m.m[2]);
      x.botID = unquote(m.m[3]);
      x.computerID = unquote(m.m[4]);
      try {
        x.dialogHistory = (List) unstructure(unquote(m.m[5]));
      } catch (RuntimeException e) {
        print("oops: " + m.m[5]);
      }
      entries.add(x);
      saveLocally("entries");
      return "OK, now " + entries.size() + " entries.";
    }
    
    return standardQuery(s, "entries");
  }
}

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: 611 / 921
Referenced in: [show references]