aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorBen Kelly <bk@ancilla.ca>2017-04-20 10:36:42 -0400
committerBen Kelly <btk@google.com>2017-04-21 11:57:34 -0400
commit5dfa8bf758df628ea8bf095fffc95fe25fe16fb0 (patch)
tree4b83ca4e19c8fa5e80498e0fa341e4710c2cbcdd /wee_slack.py
parentf4746f965bc54e2511fa6adc9ec9909c88c4f479 (diff)
downloadwee-slack-5dfa8bf758df628ea8bf095fffc95fe25fe16fb0.tar.gz
Fix channel history not appearing when an earlier message has 'text': None
Today I learned that sometimes, rather than the key missing, it has the value None. In this case, (key in dict) is true! This fixes an issue where, if the backscroll of a channel contained such a message, it would throw while fetching the backscroll and cut off without fetching all of it. Signed-off-by: Ben Kelly <btk@google.com> Signed-off-by: Ben Kelly <bk@ancilla.ca>
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py
index a3d43ce..e5aaa9a 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1859,8 +1859,8 @@ class SlackMessage(object):
self.sender, self.sender_plain = senders[0], senders[1]
self.suffix = ''
self.ts = SlackTS(message_json['ts'])
- text = self.message_json.get('text', '')
- if text.startswith('_') and text.endswith('_') and 'subtype' not in message_json:
+ text = self.message_json.get('text')
+ if text and text.startswith('_') and text.endswith('_') and 'subtype' not in message_json:
message_json['text'] = text[1:-1]
message_json['subtype'] = 'me_message'
if message_json.get('subtype') == 'me_message' and not message_json['text'].startswith(self.sender):