Libraryless. Click here for Pure Java version (919L/7K/22K).
1 | !752 |
2 | |
3 | static S token; |
4 | static S channelID = "C0FH9PY8J"; // #talkingbots |
5 | static S timestamp = "1449606813.001101"; |
6 | |
7 | p { |
8 | token = loadSecretTextFileMandatory("#1001889", "relp-slack-botstuff-token").trim(); |
9 | S url = "https://slack.com/api/reactions.get"; |
10 | S postData = "token=" + urlencode(token) + "&channel=" + urlencode(channelID) + "×tamp=" + urlencode(timestamp); |
11 | S data = doPost(postData, url); |
12 | print(data); |
13 | Map map = jsonDecodeMap(data); |
14 | Map msg = cast map.get("message"); |
15 | printStructure(msg); |
16 | L<Map> reactions = cast msg.get("reactions"); |
17 | printStructure(reactions); |
18 | for (Map r : reactions) { |
19 | S name = cast r.get("name"); |
20 | if (litlist("+1").contains(name)) |
21 | print("+1!"); |
22 | } |
23 | } |
Began life as a copy of #1001889
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001938 |
Snippet name: | Test querying Slack reactions |
Eternal ID of this version: | #1001938/1 |
Text MD5: | bba9917ad3acfddbb47fbabb80fc4d9c |
Transpilation MD5: | 26621e3d6be5e60f91f8771771457742 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-08 21:49:54 |
Source code size: | 742 bytes / 23 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 753 / 745 |
Referenced in: | [show references] |