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

26
LINES

< > BotCompany Repo | #1021968 // gazelle_addRespondToHumanOnlyHelpers

JavaX fragment (include)

scope gazelle_addRespondToHumanOnlyHelpers.

sclass #Check {
  bool debug;
 
  *() {}
  *(bool *debug) {}
  
  SS get(SS map, LS tokC, LS tokI, RuleEngine2_MatchedRule matched) {
    if (map == null) null;
    if (debug) print("humanOnlyHelper for " + matched.ruleID() + ": " + matched.inputsByType);
    if (!eq("true", matched.inputsByType.get("_respondingToHuman"))) null;
    ret map;
  }
}

svoid gazelle_addRespondToHumanOnlyHelpers(RuleEngine2 engine, O... _) {
  bool debug = boolPar debug(_) || boolPar humanOnlyDebug(_);
  for (final RuleEngine2.Rule r : engine.rules)
    if (cic(r.comments, "only answer to human")) {
      if (debug) print("Made human-only helper");
      r.addMapMassager(new Check(debug));
    }
}

end scope

Author comment

Began life as a copy of #1021865

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: #1021968
Snippet name: gazelle_addRespondToHumanOnlyHelpers
Eternal ID of this version: #1021968/6
Text MD5: 5a0cd14e9e37128ed7e20b74738bdcec
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-04 13:48:47
Source code size: 765 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 251 / 292
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)