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

27
LINES

< > BotCompany Repo | #1017853 // Show user's follow-up message after every rule fired [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (9444L/66K).

!7

p-exp {
  replace Msg with TelegramMsg. // We're lazy!
  
  LPair<TelegramMsg, LS> l = serverTelegramLog_plusFiredRules();
  MultiSet<S> userMsgs = ciMultiSet();
  for i over l: {
    LS rules = l.get(i).b;
    if (empty(rules)) continue;
    Msg msg = l.get(i).a;
    int j = i+1;
    while (j < l(l) && l.get(j).a.sent) ++j; // Find next user msg
    L<Msg> nextMsgs = pairsA(subList(l, i+1, j+1));
    Msg userMsg = null;
    if (nempty(nextMsgs)) {
      print(renderTelegramMsg1(msg));
      for (Msg m : nextMsgs) {
        printIndent(renderTelegramMsgWithTimeDiff(m, msg));
        if (userMsg == null && !m.sent) userMsg = msg;
      }
    }
    if (userMsg != null) userMsgs.add(userMsg.text);
  }
  print();
  pnl(multiSetAsMap_popularFirst(userMsgs));
}

Author comment

Began life as a copy of #1017851

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017853
Snippet name: Show user's follow-up message after every rule fired [OK]
Eternal ID of this version: #1017853/13
Text MD5: 5a684c204a799f22eed72418aac76c78
Transpilation MD5: ef3faee342d1bcca71d4b34c72522a9d
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-18 19:33:12
Source code size: 795 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 386 / 1035
Version history: 12 change(s)
Referenced in: #1017865 - Collect feedback & possible feedback for fired rules in mech list (OK)