]> git.cworth.org Git - turbot/blobdiff - turbot/interaction.py
Restrict a Slack channel topic to 250 characters
[turbot] / turbot / interaction.py
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)