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

!747

m {
  static S botToReferTo;
  
  static S lastQuestion;
  static boolean bypass;
  
  p {
    makeAndroid3("Joke Bot.");
  }
  
  static synchronized S answer(S s, L<S> history) {
    if (!bypass) {
      if (match3("how many", s) || match3("how many ...", s)) {
        lastQuestion = s;
        return "" + randomNumber();
      }
  
      if (match3("ok joke bot ...", s)) {
        bypass = true;
        return "ok ok. " + sendToLocalBot(botToReferTo, lastQuestion);
      }
    }
    
    ret sendToLocalBotOpt(botToReferTo, s);
  }
  
  static long randomNumber() {
    return new Random().nextLong();
  }
}

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