static int slackReactionScore(S token, S channelID, S timestamp) { S url = "https://slack.com/api/reactions.get"; S postData = "token=" + urlencode(token) + "&channel=" + urlencode(channelID) + "×tamp=" + urlencode(timestamp); S data = doPostWithTimeout(postData, url, slackSetTimeout_get()); Map map = jsonDecodeMap(data); Map msg = cast map.get("message"); if (msg == null) ret 0; //printStructure(msg); L<Map> reactions = cast msg.get("reactions"); if (reactions == null) ret 0; //printStructure(reactions); int score = 0; for (Map r : reactions) { S name = cast r.get("name"); int count = (int) r.get("count"); if (litlist("confused").contains(name)) score -= count; else score += count; /*else print("Unknown reaction emoji: " + name);*/ } ret score; }
Began life as a copy of #1001938
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1001940 |
| Snippet name: | slackReactionScore |
| Eternal ID of this version: | #1001940/1 |
| Text MD5: | 8bbf72bba92993ab2a5dd76aaf938c4c |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-04-02 20:12:58 |
| Source code size: | 855 bytes / 24 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1062 / 1554 |
| Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) |