diff options
author | Ryan Huber <rhuber@gmail.com> | 2014-11-12 15:09:00 -0800 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2014-11-12 15:09:00 -0800 |
commit | 781349f70f75cbd67040313f24b649bb88eb601b (patch) | |
tree | 91b3ff4c8beb5e8ac09ae1447994cf5d4e344a7d /wee_slack.py | |
parent | 3d9a92b1beb42626aa3433b3f8680f075c53a676 (diff) | |
download | wee-slack-781349f70f75cbd67040313f24b649bb88eb601b.tar.gz |
better parsing of user_id and chan_id
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py index a9e62c1..7094c86 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -837,8 +837,10 @@ def unfurl_refs(text): text = text.split(" ") for item in text: #dbg(item) - if item.startswith('<') and item.endswith('>'): - item = item[1:-1] + start = item.find('<') + end = item.find('>') + if start > -1 and end > -1: + item = item[start+1:end] if item.find('|') > -1: item = item.split('|')[0] if item.startswith('@U'): @@ -847,9 +849,9 @@ def unfurl_refs(text): item = "@%s" % users.find(item[1:]).name except: dbg("NAME: " + str(item)) - if item.startswith('#c'): + if item.startswith('#C'): if channels.find(item[1:]): - item = "#%s" % channels.find(item[1:]).name + item = "%s" % channels.find(item[1:]).name newtext.append(item) text = " ".join(newtext) return text |