Libraryless. Click here for Pure Java version (1287L/10K/31K).
1 | !752 |
2 | |
3 | // L<SlackMsg> slackSlurp: S channelID, S token, int limit, S oldest, S latest, boolean inclusive |
4 | |
5 | p { |
6 | S token = loadRelpToken(); |
7 | Map<S, S> channels = slackGetChannelIDs(token); |
8 | S channel = "talkingbots"; |
9 | int limit = 1000; |
10 | S latest = null; |
11 | L<SlackMsg> l; |
12 | int n = 0; // safety switch #1 - never suck more than 100.000 msgs |
13 | do { |
14 | // TODO: special case when there are no more messages. |
15 | l = slackSlurp(channels.get(channel), token, limit, null, latest, false); |
16 | S newLatest = first(l).ts; |
17 | assertNotNull(newLatest); |
18 | |
19 | // safety switch #2 |
20 | if (latest != null) assertTrue(cmp(latest, newLatest) > 0); |
21 | |
22 | latest = newLatest; |
23 | print("latest=" + latest); |
24 | print(l(l) + " messages slurped from #" + channel); |
25 | } while (l(l) == limit && ++n < 100); |
26 | } |
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: | 782 / 739 |
Referenced in: | [show references] |