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

33
LINES

< > BotCompany Repo | #1022812 // Current time dialog v2 [shortened, same functionality as v1]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (11380L/59K).

1  
!7
2  
3  
cmodule CurrentTimeDialog > DynSayAndInputBot {
4  
  class TimeBot extends AbstractSayAndInputBot2 implements Runnable {
5  
    Attractor
6  
      thanks = new MatchAttractor("thanks|thank you|thx", r { say("You're welcome") }),
7  
      whatCanYouDo = new MatchAttractor("what can you do...|what is your skill|who are you", r {
8  
        say("I can tell you the time");
9  
        addAttractor(doIt);
10  
      }),
11  
      doIt = new MatchAttractor("do it|ok|i want that", r sayTime),
12  
      talkToMe = new MatchAttractor("talk to me|hi|talk|say something", r run_public),
13  
      doItAgain = new MatchAttractor("do it again|again|another time", r sayTime),
14  
      whatsTheTime = new MatchAttractor("what's the time|tell me the time|time", r sayTime),
15  
      yes_SayTime = new Attractor(f<S, Bool> isYes_1, r sayTime),
16  
      sayOK = new Attractor(f1_true(), r { say("OK") });
17  
      
18  
    *() {
19  
      addPreprocessors(f ai_dropLeadingAndTrailingAppellations_sortedByLength);
20  
      standardAttractors(doItAgain, whatsTheTime, talkToMe, whatCanYouDo, thanks);
21  
    }
22  
    
23  
    public void run {
24  
      say("Do you want to know the current time?");
25  
      addAttractor(yes_SayTime);
26  
      addLowPrioAttractor(sayOK);
27  
    }
28  
    
29  
    void sayTime { say("It is " + localTime_24()); }
30  
  }
31  
  
32  
  TimeBot makeBot() { ret new TimeBot; }
33  
}

Author comment

Began life as a copy of #1022809

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022812
Snippet name: Current time dialog v2 [shortened, same functionality as v1]
Eternal ID of this version: #1022812/10
Text MD5: 254534f7f681268ded34a53029059fdb
Transpilation MD5: da694531638cab6f0c169f9839e8f349
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-09 01:05:54
Source code size: 1330 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 230 / 394
Version history: 9 change(s)
Referenced in: [show references]