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

35
LINES

< > BotCompany Repo | #1022819 // AI_CurrentTimeBot

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7073L/47K).

sclass AI_CurrentTimeBot > AttractorBot {
  // MAIN FUNCTION
  
  void sayTime { say("It is " + localTime_24()); }
  
  // FLOW START
  
  public void run {
    say("Do you want to know the current time?");
    addAttractor(yes_SayTime);
    addLowPrioAttractor(sayOK);
  }
  
  // CONFIG
  
  *() {
    standardAttractors(doItAgain, whatsTheTime, talkToMe, whatCanYouDo, thanks,
      new MatchAttractor("can you do anything else", r { say("no") }),
      new MatchAttractor("what else can you do", r { say("nothing") }));
  }
  
  // ATTRACTORS
  
  MatchAttractor thanks = new("thanks|thank you|thx", r { say("You're welcome") });
  MatchAttractor whatCanYouDo = new("what can you do...|what is your skill|who are you", r {
    say("I can tell you the time");
    addAttractor(doIt);
  });
  MatchAttractor doIt = new("do it|ok|i want that", r sayTime);
  MatchAttractor talkToMe = new("talk to me|hi|talk|say something", r run_public);
  MatchAttractor doItAgain = new("do it again|again|another time|do your trick again", r sayTime);
  MatchAttractor whatsTheTime = new("what's the time|tell me the time|time", r sayTime);
  Attractor yes_SayTime = new(f<S, Bool> isYes_1, r sayTime);
  DefaultAttractor sayOK = new(r { say("OK") });
}

Author comment

Began life as a copy of #1022814

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: #1022819
Snippet name: AI_CurrentTimeBot
Eternal ID of this version: #1022819/1
Text MD5: e055d46f71b083157812f394dae1c9bb
Transpilation MD5: ebf3a5d3c06e474459123fccdeccbfcd
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-09 10:58:48
Source code size: 1274 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 320 / 808
Referenced in: #1022826 - AI_DomainsBot [dev.]
#1022834 - AI_DatesBot
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)