]> git.cworth.org Git - turbot/blobdiff - turbot/util/hunt-channel-topic-tweak.py
Add some utility code
[turbot] / turbot / util / hunt-channel-topic-tweak.py
diff --git a/turbot/util/hunt-channel-topic-tweak.py b/turbot/util/hunt-channel-topic-tweak.py
new file mode 100755 (executable)
index 0000000..2951894
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+from urllib.parse import parse_qs
+from slack import WebClient
+import base64
+import boto3
+import requests
+import json
+import pickle
+import os
+import sys
+from types import SimpleNamespace
+from google.auth.transport.requests import Request
+from googleapiclient.discovery import build
+
+# Note: Late import here to have the environment variable above available
+
+if 'SLACK_BOT_TOKEN' in os.environ:
+    slack_bot_token = os.environ['SLACK_BOT_TOKEN']
+else:
+    print("Please set SLACK_BOT_TOKEN in environment variable")
+    sys.exit(1)
+slack_client = WebClient(slack_bot_token)
+
+channel_id='C01K8FJJMR7'
+puzzle_url="https://perpendicular.institute/puzzle/%E2%9C%8F/"
+sheet_url='https://docs.google.com/spreadsheets/d/1951ZTGLvSq5PqHPQ1ygqddRjennsedkNtCaOGH__dMo/edit#gid=2097467701'
+title="(See `/puzzle` for title)"
+topic="(<{}|Puzzle>,<{}|Sheet>) {}".format(puzzle_url, sheet_url, title)
+
+slack_client.conversations_setTopic(channel=channel_id,
+                                    topic=topic)