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

21
LINES

< > BotCompany Repo | #1002232 // List IM Users Bot

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

Libraryless. Click here for Pure Java version (1228L/9K/27K).

1  
!752
2  
3  
answer {
4  
  if match "list your im channels" {
5  
    S token = devChannelToken();
6  
    S url = "https://slack.com/api/im.list";
7  
    Map postData = litmap("token", token);
8  
    S data = doPost(postData, url);
9  
    print(data);
10  
    Map map = jsonDecodeMap(data);
11  
    List<Map> ims = cast map.get("ims");
12  
    new L<S> names;
13  
    for (Map _m : ims) {
14  
      S userID = getString(_m, "user");
15  
      //print("userID = " + userID);
16  
      S userName = slackGetUserName(token, userID);
17  
      names.add(userName);
18  
    }
19  
    ret "I have IM channels with: " + join(", ", names);
20  
  }
21  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002232
Snippet name: List IM Users Bot
Eternal ID of this version: #1002232/1
Text MD5: 60638274ec00e1d553d066a4c97b1925
Transpilation MD5: beac23224be244652e71d0017dbfd3cc
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-30 20:17:52
Source code size: 591 bytes / 21 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 550 / 1483
Referenced in: [show references]