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).

1  
!747
2  
3  
m {
4  
  p {
5  
    while (true) {
6  
      S line = suckFromChat();
7  
      if (line.length() == 0) continue;
8  
      L<S> tok = javaTok(line);
9  
      S text = unquote(tok.get(tok.size()-2));
10  
      final S guy = tok.get(1);
11  
      if (text.startsWith("?? ")) {
12  
        final S question = text.substring(3);
13  
        thread {
14  
          S answer = getAnswer(question);
15  
          if (answer != null && answer.length() != 0) {
16  
            S x = guy + ": " + answer;
17  
            if (isAutoReportToChatOn())
18  
              print(x); // Printing (=thinking) is enough for being heard around here :-))
19  
            else
20  
              reportToChat(x);
21  
          }
22  
        }
23  
      }
24  
    }
25  
  }
26  
  
27  
  static S getAnswer(S question) {
28  
    return "I know that you " + question;
29  
  }
30  
}

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