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

26
LINES

< > BotCompany Repo | #1021968 // gazelle_addRespondToHumanOnlyHelpers

JavaX fragment (include)

1  
scope gazelle_addRespondToHumanOnlyHelpers.
2  
3  
sclass #Check {
4  
  bool debug;
5  
 
6  
  *() {}
7  
  *(bool *debug) {}
8  
  
9  
  SS get(SS map, LS tokC, LS tokI, RuleEngine2_MatchedRule matched) {
10  
    if (map == null) null;
11  
    if (debug) print("humanOnlyHelper for " + matched.ruleID() + ": " + matched.inputsByType);
12  
    if (!eq("true", matched.inputsByType.get("_respondingToHuman"))) null;
13  
    ret map;
14  
  }
15  
}
16  
17  
svoid gazelle_addRespondToHumanOnlyHelpers(RuleEngine2 engine, O... _) {
18  
  bool debug = boolPar debug(_) || boolPar humanOnlyDebug(_);
19  
  for (final RuleEngine2.Rule r : engine.rules)
20  
    if (cic(r.comments, "only answer to human")) {
21  
      if (debug) print("Made human-only helper");
22  
      r.addMapMassager(new Check(debug));
23  
    }
24  
}
25  
26  
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: 252 / 293
Version history: 5 change(s)
Referenced in: [show references]