]> git.cworth.org Git - turbot/commitdiff
Use best-practice <@user_id> to mention a user in Slack
authorCarl Worth <cworth@cworth.org>
Sat, 9 Jan 2021 15:45:37 +0000 (07:45 -0800)
committerCarl Worth <cworth@cworth.org>
Sat, 9 Jan 2021 15:48:15 +0000 (07:48 -0800)
This way Slack expands this as a link to the user's full name.

TODO
turbot/interaction.py

diff --git a/TODO b/TODO
index 9f9b903113a9d9e84b815c210abadf9fc57f02d7..bc8385d1537f0ae200ccfb52db1126bedb0ce83b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -15,10 +15,6 @@ Recently-proposed ideas (not yet prioritized)
   (since the implicit report from settting the abbreviated topic won't
   have the whole message).
 
   (since the implicit report from settting the abbreviated topic won't
   have the whole message).
 
-• In messages (like from /solved) don't use a raw user_name value from
-  the request, but instead some tagged version of a user ID (which
-  Slack will render as a display name).
-
 • Allow a hunt (and perhaps a round) to have multiple URLs
 
 • Provide an "Archive channel" button in the channel when outputting
 • Allow a hunt (and perhaps a round) to have multiple URLs
 
 • Provide an "Archive channel" button in the channel when outputting
index 1f5d11f4b4218b9a92680088d87521d69c6cd74b..ec64706658f3126bfc1974921d12e4cdece78ffe 100644 (file)
@@ -967,7 +967,7 @@ def solved(turb, body, args):
     The args string should be a confirmed solution."""
 
     channel_id = body['channel_id'][0]
     The args string should be a confirmed solution."""
 
     channel_id = body['channel_id'][0]
-    user_name = body['user_name'][0]
+    user_id = body['user_id'][0]
 
     old_puzzle = puzzle_for_channel(turb, channel_id)
 
 
     old_puzzle = puzzle_for_channel(turb, channel_id)
 
@@ -991,7 +991,7 @@ def solved(turb, body, args):
     # Report the solution to the puzzle's channel
     slack_send_message(
         turb.slack_client, channel_id,
     # Report the solution to the puzzle's channel
     slack_send_message(
         turb.slack_client, channel_id,
-        "Puzzle mark solved by {}: `{}`".format(user_name, args))
+        "Puzzle mark solved by <@{}>: `{}`".format(user_id, args))
 
     # Also report the solution to the hunt channel
     hunt = find_hunt_for_hunt_id(turb, puzzle['hunt_id'])
 
     # Also report the solution to the hunt channel
     hunt = find_hunt_for_hunt_id(turb, puzzle['hunt_id'])