]> git.cworth.org Git - turbot/blobdiff - turbot/slack.py
Share the rot() implementation between both Lambda and Flask implementations
[turbot] / turbot / slack.py
index 998282286efdde6e81de8c0669c0d4bedcd0ed34..34fe44d0a6cf543ff89a02763747d358b5cd9047 100644 (file)
@@ -53,7 +53,10 @@ def slack_send_reply(request, text):
         if (resp.status_code != 200):
             app.logger.error("Error posting request to Slack: " + resp.text)
     else:
-        try:
-            slack_client.chat_postMessage(channel=channel, text=text)
-        except SlackApiError as e:
-            app.logger.error("Slack API error: " + e.response["error"])
+        slack_send_message(channel, text)
+
+def slack_send_message(channel, text):
+    """Send a Slack message to a specified channel."""
+
+    slack_client.chat_postMessage(channel=channel, text=text)
+