]> git.cworth.org Git - turbot/commitdiff
Restrict a Slack channel topic to 250 characters
authorCarl Worth <cworth@cworth.org>
Fri, 1 Jan 2021 19:06:26 +0000 (11:06 -0800)
committerCarl Worth <cworth@cworth.org>
Fri, 1 Jan 2021 19:12:39 +0000 (11:12 -0800)
And terminate it with an ellipsis if the user-provided state string is
too long. (It's a bit annoying that Slack returns an error rather than
just doing this same thing itself, but whatever.)

This satisfies a TODO item since users had encountered this error
during our last hunt.

TODO
turbot/interaction.py

diff --git a/TODO b/TODO
index dc5b41c0d10d077e9fa48d23376150b5e936bce4..34d5a36df807196a92c787cdf538ea3504e35cb5 100644 (file)
--- a/TODO
+++ b/TODO
@@ -92,13 +92,6 @@ Un-prioritized items
 • Decide a good plan for audio/video calls for puzzles and integrate
   that into Turbot.
 
-• Inspect the CloudWatch logs for our Turbot AWS Lambda during the time
-  period of the active hunt, (October 24-31), find and diagnose any
-  errors that occurred during that period. Users reported seeing
-  "Trouble connecting" (probably during new-puzzle dialog submission)
-  as well as "dispatch_failed during /state command (perhaps due to a
-  state string that was very long).
-
 • Think about some way to express solve priority
 
 Lower priority
index 8ccd24755af036114326b77af30de595e8cd91fe..dfe99c15059cc1060c798186e72eb8372d882fb3 100644 (file)
@@ -520,6 +520,10 @@ def set_channel_topic(turb, puzzle):
     if state:
         description += " {}".format(state)
 
+    # Slack only allows 250 characters for a topic
+    if len(description) > 250:
+        description = description[:247] + "..."
+
     turb.slack_client.conversations_setTopic(channel=channel_id,
                                              topic=description)