aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2014-07-17 15:32:26 -0700
committerRyan Huber <rhuber@gmail.com>2014-07-17 15:32:26 -0700
commitf0f4ee647f184394bd013986b07abed81671aee8 (patch)
tree9ad7bb2c2b4e050875978f810264bdcd7371e962 /wee_slack.py
parent8303844847135c2f628818ffc9e93468612aa4b5 (diff)
downloadwee-slack-f0f4ee647f184394bd013986b07abed81671aee8.tar.gz
handle bad token
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 2f6fb08..97a28c9 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -300,18 +300,21 @@ def connect_to_slack():
if reply.code == 200:
data = reply.read()
login_data = json.loads(data)
- nick = login_data["self"]["name"]
- domain = login_data["team"]["domain"] + ".slack.com"
+ if login_data["ok"] == True:
+ nick = login_data["self"]["name"]
+ domain = login_data["team"]["domain"] + ".slack.com"
- create_slack_lookup_hashes(login_data)
- create_slack_websocket(login_data)
+ create_slack_lookup_hashes(login_data)
+ create_slack_websocket(login_data)
- general_buffer_ptr = w.buffer_search("",server+".#general")
- nick_ptr = w.nicklist_search_nick(general_buffer_ptr,'',nick)
- name = w.nicklist_nick_get_string(general_buffer_ptr,nick,'name')
+ general_buffer_ptr = w.buffer_search("",server+".#general")
+ nick_ptr = w.nicklist_search_nick(general_buffer_ptr,'',nick)
+ name = w.nicklist_nick_get_string(general_buffer_ptr,nick,'name')
- connected = True
- return True
+ connected = True
+ return True
+ else:
+ w.prnt("", "\n!! slack.com login error: " + login_data["error"] + "\n\n")
else:
connected = False
return False