From 0b8af6b20b55e54c309a1f1dd86016a88ee3eb26 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sat, 24 Aug 2019 20:02:20 +0200 Subject: 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. --- wee_slack.py | 8 ++++---- 1 file 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 -- cgit