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

23
LINES

< > BotCompany Repo | #1001938 // Test querying Slack reactions

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

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

!752

static S token;
static S channelID = "C0FH9PY8J"; // #talkingbots
static S timestamp = "1449606813.001101";

p {
  token = loadSecretTextFileMandatory("#1001889", "relp-slack-botstuff-token").trim();
  S url = "https://slack.com/api/reactions.get";
  S postData = "token=" + urlencode(token) + "&channel=" + urlencode(channelID) + "&timestamp=" + urlencode(timestamp);
  S data = doPost(postData, url);
  print(data);
  Map map = jsonDecodeMap(data);
  Map msg = cast map.get("message");
  printStructure(msg);
  L<Map> reactions = cast msg.get("reactions");
  printStructure(reactions);
  for (Map r : reactions) {
    S name = cast r.get("name");
    if (litlist("+1").contains(name))
      print("+1!");
  }
}

Author comment

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: 671 / 649
Referenced in: [show references]