]> git.cworth.org Git - turbot/blobdiff - turbot/slack.py
Use a thread for creating the Google Sheet when a new channel is created
[turbot] / turbot / slack.py
index 62181005bc301aafe458cdb6ce560af19b9d877c..34fe44d0a6cf543ff89a02763747d358b5cd9047 100644 (file)
@@ -56,18 +56,7 @@ def slack_send_reply(request, text):
         slack_send_message(channel, text)
 
 def slack_send_message(channel, text):
-    """Send a Slack message to a specified channel.
+    """Send a Slack message to a specified channel."""
 
-    Note: If flask is in debug mode, this function will just print the
-    text to stdout."""
-
-    app = current_app
-
-    if (app.debug):
-        print("Sending message to channel '{}': {}".format(channel, text))
-        return
+    slack_client.chat_postMessage(channel=channel, text=text)
 
-    try:
-        slack_client.chat_postMessage(channel=channel, text=text)
-    except SlackApiError as e:
-        app.logger.error("Slack API error: " + e.response["error"])