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

18
LINES

< > BotCompany Repo | #1001947 // Read Slack bot's feedback from disk (works)

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

Libraryless. Click here for Pure Java version (979L/7K/22K).

1  
!752
2  
3  
p {
4  
  S logName = "feedback-log";
5  
  //S logName = "memory-log";
6  
  int plus = 0, minus = 0, lines = 0;
7  
  for (S s : scanLog("#1001915", logName)) pcall {
8  
    ++lines;
9  
    Map map = cast safeUnstructure(s);
10  
    print(structure(map));
11  
    Number score = cast map.get("score");
12  
    if (score != null) {
13  
      int x = score.intValue();
14  
      if (x > 0) plus += x; else minus -= x;
15  
    }
16  
  }
17  
  print("Total plus: " + plus + ", total minus: " + minus + ", lines read: " + lines);
18  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001947
Snippet name: Read Slack bot's feedback from disk (works)
Eternal ID of this version: #1001947/1
Text MD5: 03738f18e9c7c00d84385251e8fc4dc3
Transpilation MD5: 8fb036f2a7de16ee2a5b9e115019eaeb
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-10 21:27:51
Source code size: 497 bytes / 18 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 719 / 733
Referenced in: [show references]