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

30
LINES

< > BotCompany Repo | #1000977 // Answer questions on chat

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

Libraryless. Click here for Pure Java version (872L/7K/22K).

!747

m {
  p {
    while (true) {
      S line = suckFromChat();
      if (line.length() == 0) continue;
      L<S> tok = javaTok(line);
      S text = unquote(tok.get(tok.size()-2));
      final S guy = tok.get(1);
      if (text.startsWith("?? ")) {
        final S question = text.substring(3);
        thread {
          S answer = getAnswer(question);
          if (answer != null && answer.length() != 0) {
            S x = guy + ": " + answer;
            if (isAutoReportToChatOn())
              print(x); // Printing (=thinking) is enough for being heard around here :-))
            else
              reportToChat(x);
          }
        }
      }
    }
  }
  
  static S getAnswer(S question) {
    return "I know that you " + question;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000977
Snippet name: Answer questions on chat
Eternal ID of this version: #1000977/1
Text MD5: fc1674b62195c7dad898a18aa60a70e1
Transpilation MD5: b4d7a76e96280f6c3531cfdda6329744
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-09-13 03:26:54
Source code size: 786 bytes / 30 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 558 / 554
Referenced in: [show references]