Libraryless. Click here for Pure Java version (1711L/12K/39K).
!752 static S channelID = "C0FH9PY8J"; // relp, #talkingbots static S token; static PersistentLog<SlackMsg> msgs; static new Map<S, S> lastSeenByChannel; p { if (token == null) token = loadSecretTextFileMandatory("#1001889", "relp-slack-botstuff-token").trim(); msgs = new PersistentLog<SlackMsg>("msgs"); for (SlackMsg msg : msgs) { S s = lastSeenByChannel.get(msg); if (s == null || msg.ts.compareTo(s) > 0) lastSeenByChannel.put(channelID, msg.ts); } while true { pcall { int limit = 1000; L<SlackMsg> newMsgs = slackReadChannel(channelID, token, limit, lastSeenByChannel.get(channelID)); msgs.addAll(newMsgs); if (!newMsgs.isEmpty()) { print(l(newMsgs) + " new messages in " + channelID + "."); lastSeenByChannel.put(channelID, last(newMsgs).ts); } } sleepSeconds(5); } }
Began life as a copy of #1001915
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: | #1001979 |
Snippet name: | Old Slack Slurper (sucks Slack channels & stores them) |
Eternal ID of this version: | #1001979/1 |
Text MD5: | 60dc0d1ebf4f16cd94afee7e22d60c8b |
Transpilation MD5: | 74908f4c2d37793d05404aceb88160cf |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-23 21:17:07 |
Source code size: | 918 bytes / 34 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 621 / 877 |
Referenced in: | #1001980 - Print all slurped messages #3000202 - Answer for stefanreich (>> T conversion bot) #3000238 - Answer for stefanreich (>> t power bot) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |