From 9e666945fc81f4220efffe79b3202ae39acd60e5 Mon Sep 17 00:00:00 2001 From: Ryan Huber Date: Mon, 6 Feb 2017 12:54:28 -0800 Subject: print a message when getting history --- wee_slack.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index c2ac5a6..b7f4f20 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1115,7 +1115,7 @@ class SlackChannel(object): if self.team.connected: w.buffer_clear(self.channel_buffer) self.buffer_prnt('', 'getting channel history...', tagset='backlog') - s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["history"], {"channel": self.identifier, "count": BACKLOG_SIZE}, team_hash=self.team.team_hash, channel_identifier=self.identifier) + s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["history"], {"channel": self.identifier, "count": BACKLOG_SIZE}, team_hash=self.team.team_hash, channel_identifier=self.identifier, clear=True) self.eventrouter.receive(s) self.got_history = True def send_add_reaction(self, msg_number, reaction): @@ -1725,7 +1725,14 @@ def handle_history(message_json, eventrouter, **kwargs): request_metadata = pickle.loads(message_json["wee_slack_request_metadata"]) kwargs['team'] = eventrouter.teams[request_metadata.team_hash] kwargs['channel'] = kwargs['team'].channels[request_metadata.channel_identifier] + try: + clear = request_metadata.clear + except: + clear = False + print clear kwargs['output_type'] = "backlog" + if clear: + w.buffer_clear(kwargs['channel'].channel_buffer) for message in reversed(message_json["messages"]): process_message(message, eventrouter, **kwargs) -- cgit