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

38
LINES

< > BotCompany Repo | #1001976 // I Have Bot (developing)

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

Transpiled version (1995L) is out of date.

!752

static class Msg {
  S user, text;
  
  *(S *user, S *text) {}
  *() {}
}

// persistent
static PersistentLog<Msg> msgs;

// built every time in memory
static new MultiMap<S, Msg> msgsByUser;

p {
  msgs = new PersistentLog<Msg>("incoming-msgs");
  for (Msg m : msgs) pcall { answer(m.text, m.user); }
  
  makeBot("I Have Bot.");
}

static S answer(S s) {
  ret answer(s, "user");
}

static synchronized S answer(S s, S user) {
  msgs.add(new Msg(user, s));
  new Matches m;
  ret answerImpl(user);
  msgsByUser.put(m.user, m);
  if (matchStart("i have", s, m)) {
    print(structure(m));
    S rest = m.rest();
    print("Rest: " + quote(rest));
    ret "ok";
  }
}

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: #1001976
Snippet name: I Have Bot (developing)
Eternal ID of this version: #1001976/1
Text MD5: 4b9b0bc81274198aaaad9b66937c32fa
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-10 20:14:54
Source code size: 710 bytes / 38 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 613 / 687
Referenced in: [show references]