diff options
author | Ryan Huber <rhuber@gmail.com> | 2017-02-03 21:58:35 -0800 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2017-02-03 21:58:35 -0800 |
commit | 7e6368dd65f7d0a98b1da66951ebc465f4f7e4f4 (patch) | |
tree | 526e79e41c44c31ec971c44d3dc0e0757677ac76 | |
parent | d5dddfe87c016f4bde2bcf975745665c7c8cff33 (diff) | |
download | wee-slack-7e6368dd65f7d0a98b1da66951ebc465f4f7e4f4.tar.gz |
multiple tokens
-rw-r--r-- | wee_slack.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/wee_slack.py b/wee_slack.py index 237f7bf..bf57425 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1125,6 +1125,8 @@ class SlackTS(object): return 1 elif s == other: return 0 + def __hash__(self): + return hash("{}.{}".format(self.major, self.minor)) def __repr__(self): return str("{0}.{1:06d}".format(self.major, self.minor)) def split(self, *args, **kwargs): @@ -1287,6 +1289,7 @@ def process_message(message_json, eventrouter, store=True, **kwargs): dbg("NORMAL REPLY {}".format(message_json)) except: channel.buffer_prnt("WEE-SLACK-ERROR", json.dumps(message_json).encode('utf-8'), message_json["ts"], **kwargs) + traceback.print_exc() def subprocess_thread_message(message_json, eventrouter, channel, team): dbg("REPLIEDDDD: " + str(message_json)) @@ -1945,6 +1948,8 @@ if __name__ == "__main__": w.prnt("", "\nERROR: Weechat version 1.3+ is required to use {}.\n\n".format(SCRIPT_NAME)) else: + global EVENTROUTER + EVENTROUTER = EventRouter() #setup_trace() WEECHAT_HOME = w.info_get("weechat_dir", "") @@ -2022,13 +2027,12 @@ if __name__ == "__main__": "nick_completion_cb", "") #w.bar_item_new('slack_typing_notice', 'typing_bar_item_cb', '') - tok = config.slack_api_token.split(',')[0] - s = SlackRequest(tok, 'rtm.start', {}) - global EVENTROUTER - EVENTROUTER = EventRouter() + tokens = config.slack_api_token.split(',') + for t in tokens: + s = SlackRequest(t, 'rtm.start', {}) + EVENTROUTER.receive(s) if config.record_events: EVENTROUTER.record() - EVENTROUTER.receive(s) EVENTROUTER.handle_next() w.hook_timer(10, 0, 0, "handle_next", "") # END attach to the weechat hooks we need |