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).

1  
!7
2  
3  
p-exp {
4  
  replace Msg with TelegramMsg. // We're lazy!
5  
  
6  
  LPair<TelegramMsg, LS> l = serverTelegramLog_plusFiredRules();
7  
  MultiSet<S> userMsgs = ciMultiSet();
8  
  for i over l: {
9  
    LS rules = l.get(i).b;
10  
    if (empty(rules)) continue;
11  
    Msg msg = l.get(i).a;
12  
    int j = i+1;
13  
    while (j < l(l) && l.get(j).a.sent) ++j; // Find next user msg
14  
    L<Msg> nextMsgs = pairsA(subList(l, i+1, j+1));
15  
    Msg userMsg = null;
16  
    if (nempty(nextMsgs)) {
17  
      print(renderTelegramMsg1(msg));
18  
      for (Msg m : nextMsgs) {
19  
        printIndent(renderTelegramMsgWithTimeDiff(m, msg));
20  
        if (userMsg == null && !m.sent) userMsg = msg;
21  
      }
22  
    }
23  
    if (userMsg != null) userMsgs.add(userMsg.text);
24  
  }
25  
  print();
26  
  pnl(multiSetAsMap_popularFirst(userMsgs));
27  
}

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: 385 / 1032
Version history: 12 change(s)
Referenced in: [show references]