diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-08-24 20:49:22 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-08-25 19:42:06 +0200 |
commit | c35a6d81368f81e9d2ac991c9f4ae0d22405918b (patch) | |
tree | 2b52fef3f03e0ca5818bd396bc5bab5f4c15f915 | |
parent | 64cf9f64e1097f8b4dacf08c9c6cc6a6baeb77a3 (diff) | |
download | wee-slack-c35a6d81368f81e9d2ac991c9f4ae0d22405918b.tar.gz |
Support @everyone in linkify_text
-rw-r--r-- | _pytest/test_linkifytext.py | 5 | ||||
-rw-r--r-- | wee_slack.py | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/_pytest/test_linkifytext.py b/_pytest/test_linkifytext.py index a086fde..7c67fa6 100644 --- a/_pytest/test_linkifytext.py +++ b/_pytest/test_linkifytext.py @@ -49,6 +49,11 @@ def test_linkifytext_at_channel(team): assert text == '<!channel>: my test message' +def test_linkifytext_at_everyone(team): + text = linkify_text('@everyone: my test message', team) + + assert text == '<!everyone>: my test message' + def test_linkifytext_at_group(team): text = linkify_text('@group: my test message', team) diff --git a/wee_slack.py b/wee_slack.py index 366bde6..c105a98 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3203,7 +3203,7 @@ def linkify_text(message, team): targets = re.match(r'^\s*([@#])([\w\(\)\'.-]+)(\W*)', item[1], re.UNICODE) if targets and targets.groups()[0] == '@': named = targets.groups() - if named[1] in ["group", "channel", "here"]: + if named[1] in ["channel", "everyone", "group", "here"]: message[item[0]] = "<!{}>{}".format(named[1], named[2]) elif named[0] + named[1] in usergroups.keys(): message[item[0]] = "<!subteam^{}|@{}>{}".format(usergroups[named[0] + named[1]], named[1], named[2]) |