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

71
LINES

< > BotCompany Repo | #1027704 // Repeat After Me + Go Public/Private [Cruddie Script]

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

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

!7

sclass Converter > CruddieScript {
  S answer(S s) null {
    new Matches m;
    if "what is $x C in Fahrenheit"
      ret celsiusToFahrenheit(parseDouble($x)) + " Fahrenheit";
  }
}

sclass ReproduceAnswers > CruddieScript {
  transient IF0<LS> chatLog_userMessagesOnly;
  LS chatLog_userMessagesOnly() { ret chatLog_userMessagesOnly == null ? null : chatLog_userMessagesOnly.get(); }
  
  S answer(S s) {
    LS msgs = chatLog_userMessagesOnly();
    MultiMap<S> mm = pairsToCIMultiMap(overlappingPairs(msgs));
    ret random(mm.get(s));
  }
}

sclass RepeatAfterMe > CruddieScript {
  swappable void deleteMe() {}
  swappable S rewrite(S s) { ret s; }
  
  S answer(S s) {
    new Matches m;
    if "stop repeating..." {
      deleteMe();
      ret "OK stopped";
    }
    print("Repeating: " + s);
    ret rewrite(s);
  }
}

sclass RepeatAfterMeAndSwitch > RepeatAfterMe {
  S rewrite_base(S s) { ret switcheroo(s); }
}

sclass GoPublic > CruddieScript {
  S answer(S s) null {
    if "go public"
      ret "We're all public";
    if "go private"
      ret "Can't";
    if "are you public"
      ret "Yes";
  }
}

/*sclass GoPublic > CruddieScript {
  swappable void makeBotPublic(bool b) {}
  swappable Bool isBotPublic() { null; }
  
  S answer(S s) null {
    if "go public" {
      makeBotPublic(true);
      ret "OK";
    }      
    if "go private" {
      makeBotPublic(false);
      ret "OK";
    }      
    if "are you public"
      ret trueFalseNull(isBotPublic(), "yes", "no", "not sure");
  }
}*/

cmodule SomeCruddieScripts {
}

Author comment

Began life as a copy of #1027663

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027704
Snippet name: Repeat After Me + Go Public/Private [Cruddie Script]
Eternal ID of this version: #1027704/18
Text MD5: 0c27c523511b6928304ede38d195158d
Transpilation MD5: e91198b7e5db26b19d648eb8477cc665
Author: stefan
Category: javax / chat bots
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-05 16:09:19
Source code size: 1619 bytes / 71 lines
Pitched / IR pitched: No / No
Views / Downloads: 239 / 48201
Version history: 17 change(s)
Referenced in: #1027610 - Cruddie standalone [old]
#1027675 - Cruddie Individual Frontend v4
#1027705 - Cruddie [backup before "all public" notice]
#1027730 - Some corrected misrecognitions from chat log (plus garbage)
#1027734 - Cruddie [backup before changing cookie handling]
#1028679 - Cruddie Spike [with VAT magic for Chrome]
#1028961 - cruddie.botcompany.de [LIVE]