aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2015-08-11 15:17:33 -0700
committerRyan Huber <rhuber@gmail.com>2015-08-11 15:17:33 -0700
commit0d9ca835952ab88ffd1b7aa355ef30d6fc6cffef (patch)
tree9803276680bade6dbe60f9df5e0fe1c1e8d2cb8e /wee_slack.py
parent9e9517dce1d9badecfe1827ce5c0bb9f1e4d2d03 (diff)
downloadwee-slack-0d9ca835952ab88ffd1b7aa355ef30d6fc6cffef.tar.gz
fix issues when message text == None + version bump
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 26896ca..877721f 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -21,7 +21,7 @@ except:
SCRIPT_NAME = "slack_extension"
SCRIPT_AUTHOR = "Ryan Huber <rhuber@gmail.com>"
-SCRIPT_VERSION = "0.98.5"
+SCRIPT_VERSION = "0.98.6"
SCRIPT_LICENSE = "MIT"
SCRIPT_DESC = "Extends weechat for typing notification/search/etc on slack.com"
@@ -1349,7 +1349,10 @@ def process_message(message_json, cache=True):
if "fallback" in message_json:
text = message_json["fallback"]
elif "text" in message_json:
- text = message_json["text"]
+ if message_json['text'] is not None:
+ text = message_json["text"]
+ else:
+ text = ""
else:
text = ""
@@ -1397,7 +1400,7 @@ def process_message(message_json, cache=True):
channel.cache_message(message_json)
except Exception:
- if channel:
+ if channel and ("text" in message_json) and message_json['text'] != None:
channel.buffer_prnt('unknown', message_json['text'].encode('utf-8'))
dbg("cannot process message {}\n{}".format(message_json, traceback.format_exc()))
@@ -1432,7 +1435,7 @@ def unfurl_refs(text, ignore_alt_text=False):
"""
Worst code ever written. this needs work
"""
- if text.find('<') > -1:
+ if text and text.find('<') > -1:
newtext = []
text = text.split(" ")
for item in text: