static class SlackMsg { S user, botName; // one of these is going to be set S type, text, ts; O reactions; } static L<SlackMsg> slackReadTalkingBots(int limit) { ret slackReadTalkingBots(limit, null); } static L<SlackMsg> slackReadTalkingBots(int limit, S oldest) { S channelID = "C0FH9PY8J"; // #talkingbots S token = loadSecretTextFileMandatory("#1001889", "relp-slack-botstuff-token").trim(); S url = "https://slack.com/api/channels.history"; S postData = "token=" + urlencode(token) + "&channel=" + urlencode(channelID) + "&count=" + limit + (oldest != null ? "&oldest=" + urlencode(oldest) : ""); S data = doPost(postData, url); Map map = cast jsonDecode(data); assertTrue(map.get("ok")); List<Map> _msgs = cast map.get("messages"); new L<SlackMsg> msgs; for (Map msg : reversedList(_msgs)) { new SlackMsg m; m.type = (S) msg.get("type"); m.user = (S) msg.get("user"); m.botName = (S) msg.get("username"); 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."); ret msgs; }
Began life as a copy of #1001888
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001907 |
Snippet name: | slackReadTalkingBots |
Eternal ID of this version: | #1001907/1 |
Text MD5: | af8cd2bedad766eb034d134b6d0a4b0c |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-06 19:17:15 |
Source code size: | 1221 bytes / 35 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 721 / 956 |
Referenced in: | [show references] |