diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-08-24 20:02:20 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-08-25 19:42:06 +0200 |
commit | 0b8af6b20b55e54c309a1f1dd86016a88ee3eb26 (patch) | |
tree | 08f7eadc31ab45c438e2406b631053dc8949377c /wee_slack.py | |
parent | f5cfdabb740ddbebf379fa93f9cb80b00ace2c48 (diff) | |
download | wee-slack-0b8af6b20b55e54c309a1f1dd86016a88ee3eb26.tar.gz |
Match all channel and user prefixes in unfurl_refs
I don't know all the possible prefixes, and I don't think it's a problem
to just match # and @. The prefixes I've seen for channels are #C, #D
and #G, and for users @U and @W.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py index 9e195e2..b94f443 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3243,9 +3243,9 @@ def unfurl_refs(text, ignore_alt_text=None, auto_link_display=None): if ignore_alt_text: display_text = resolve_ref(id) else: - if id.startswith("#C"): + if id.startswith("#"): display_text = "#{}".format(ref.split('|')[1]) - elif id.startswith("@U"): + elif id.startswith("@"): display_text = ref.split('|')[1] elif id.startswith("!subteam"): if ref.split('|')[1].startswith('@'): @@ -3354,12 +3354,12 @@ def resolve_ref(ref): for team in EVENTROUTER.teams.values(): if ref in ['!channel', '!everyone', '!group', '!here']: return ref.replace('!', '@') - elif ref.startswith('@U') or ref.startswith('@W'): + elif ref.startswith('@'): user = team.users.get(ref[1:]) if user: suffix = config.external_user_suffix if user.is_external else '' return '@{}{}'.format(user.name, suffix) - elif ref.startswith('#C'): + elif ref.startswith('#'): channel = team.channels.get(ref[1:]) if channel: return channel.name |