Libraryless. Click here for Pure Java version (706L/6K/18K).
!752 static class Msg { S type, user, text, ts; O reactions; } static S data; static new L<Msg> msgs; // Note: They're in reverse order! static S token = "xoxp-11444506721-15584660016-15602755169-10849bef29"; static S channelID = "C0FH9PY8J"; // #talkingbots static S oldest = "1449245380.000382"; // timestamp of first msg to get p { S url = "https://slack.com/api/channels.history"; S postData = "token=" + urlencode(token) + "&channel=" + urlencode(channelID) + "&oldest=" + urlencode(oldest); data = doPost(postData, url); Map map = cast jsonDecode(data); assertTrue(map.get("ok")); List<Map> _msgs = cast map.get("messages"); msgs = new ArrayList<Msg>(); for (Map msg : _msgs) { new Msg m; m.type = (S) msg.get("type"); m.user = (S) msg.get("user"); m.text = (S) msg.get("text"); m.ts = (S) msg.get("ts"); m.reactions = msg.get("reactions"); msgs.add(m); print(structure(m)); } print(l(msgs) + " messages sucked from slack channel."); }
Began life as a copy of #1001867
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: | #1001888 |
Snippet name: | Test channels.history on Slack 2 (reading chat contents of #talkingbots), with parsing |
Eternal ID of this version: | #1001888/1 |
Text MD5: | 3123b2d072ae734211b99fa3fbabaee7 |
Transpilation MD5: | 417a69b9b4409c7506f01df45d7d2f24 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-04 21:34:26 |
Source code size: | 1036 bytes / 34 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 680 / 642 |
Referenced in: | #1001889 - Try posting in Slack chat as "botstuff" #1001904 - Try finding bot responses in Slack channel #1001907 - slackReadTalkingBots #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) |