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

32
LINES

< > BotCompany Repo | #1001382 // Joke Bot :-)

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

Libraryless. Click here for Pure Java version (1193L/8K/30K).

1  
!747
2  
3  
m {
4  
  static S botToReferTo;
5  
  
6  
  static S lastQuestion;
7  
  static boolean bypass;
8  
  
9  
  p {
10  
    makeAndroid3("Joke Bot.");
11  
  }
12  
  
13  
  static synchronized S answer(S s, L<S> history) {
14  
    if (!bypass) {
15  
      if (match3("how many", s) || match3("how many ...", s)) {
16  
        lastQuestion = s;
17  
        return "" + randomNumber();
18  
      }
19  
  
20  
      if (match3("ok joke bot ...", s)) {
21  
        bypass = true;
22  
        return "ok ok. " + sendToLocalBot(botToReferTo, lastQuestion);
23  
      }
24  
    }
25  
    
26  
    ret sendToLocalBotOpt(botToReferTo, s);
27  
  }
28  
  
29  
  static long randomNumber() {
30  
    return new Random().nextLong();
31  
  }
32  
}

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: #1001382
Snippet name: Joke Bot :-)
Eternal ID of this version: #1001382/1
Text MD5: 71876549bad4aa4805063ae5e0ced375
Transpilation MD5: 910b4b702114e04f93b718e74c4a0c94
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-12 23:47:36
Source code size: 652 bytes / 32 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 638 / 683
Referenced in: [show references]