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

26
LINES

< > BotCompany Repo | #1002173 // Test slackSlurp

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

Libraryless. Click here for Pure Java version (1287L/10K/31K).

!752

// L<SlackMsg> slackSlurp: S channelID, S token, int limit, S oldest, S latest, boolean inclusive

p {
  S token = loadRelpToken();
  Map<S, S> channels = slackGetChannelIDs(token);
  S channel = "talkingbots";
  int limit = 1000;
  S latest = null;
  L<SlackMsg> l;
  int n = 0; // safety switch #1 - never suck more than 100.000 msgs
  do {
    // TODO: special case when there are no more messages.
    l = slackSlurp(channels.get(channel), token, limit, null, latest, false);
    S newLatest = first(l).ts;
    assertNotNull(newLatest);
    
    // safety switch #2
    if (latest != null) assertTrue(cmp(latest, newLatest) > 0);
    
    latest = newLatest;
    print("latest=" + latest);
    print(l(l) + " messages slurped from #" + channel);
  } while (l(l) == limit && ++n < 100);
}

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: #1002173
Snippet name: Test slackSlurp
Eternal ID of this version: #1002173/1
Text MD5: 8b857dfed57ecfc3fa5ee3120f765975
Transpilation MD5: dd7864ad354fb9f0454fb0055f22e17a
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-23 04:50:02
Source code size: 824 bytes / 26 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 679 / 621
Referenced in: [show references]