]> git.cworth.org Git - turbot/blob - turbot/util/hunt-channel-topic-tweak.py
2951894c72dcf73e70bdb55bba51f83dc2b6f066
[turbot] / turbot / util / hunt-channel-topic-tweak.py
1 #!/usr/bin/env python3
2
3 from urllib.parse import parse_qs
4 from slack import WebClient
5 import base64
6 import boto3
7 import requests
8 import json
9 import pickle
10 import os
11 import sys
12 from types import SimpleNamespace
13 from google.auth.transport.requests import Request
14 from googleapiclient.discovery import build
15
16 # Note: Late import here to have the environment variable above available
17
18 if 'SLACK_BOT_TOKEN' in os.environ:
19     slack_bot_token = os.environ['SLACK_BOT_TOKEN']
20 else:
21     print("Please set SLACK_BOT_TOKEN in environment variable")
22     sys.exit(1)
23 slack_client = WebClient(slack_bot_token)
24
25 channel_id='C01K8FJJMR7'
26 puzzle_url="https://perpendicular.institute/puzzle/%E2%9C%8F/"
27 sheet_url='https://docs.google.com/spreadsheets/d/1951ZTGLvSq5PqHPQ1ygqddRjennsedkNtCaOGH__dMo/edit#gid=2097467701'
28 title="(See `/puzzle` for title)"
29 topic="(<{}|Puzzle>,<{}|Sheet>) {}".format(puzzle_url, sheet_url, title)
30
31 slack_client.conversations_setTopic(channel=channel_id,
32                                     topic=topic)