-
-
Save nmurakami0/f11ef5f54e7a8454154e1c024961cc09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decrypt_env_variable(env_var): | |
ciphertext_blob = base64.b64decode(os.environ[env_var]) | |
response = kms_client.decrypt(CiphertextBlob=ciphertext_blob) | |
return response["Plaintext"].decode("utf-8") | |
slack_signing_secret = decrypt_env_variable("SLACK_SIGNING_SECRET") | |
slack_events_adapter = SlackEventAdapter(slack_signing_secret, "/slack/events", app) | |
slack_bot_token = decrypt_env_variable("SLACK_BOT_TOKEN") | |
slack_client = slack.WebClient(token=slack_bot_token) | |
def specify_facilitator(event, context): | |
if jpholiday.is_holiday(date.today()): | |
return | |
member = random.choice(members) | |
jst = timezone(timedelta(hours=9)) | |
date_str = str(datetime.now(jst).date()) | |
mtg_url = f"https://virgini-a.atlassian.net/wiki/spaces/EN/pages/383649527/{date_str}" | |
reply = f"今日のファシリテーターは、 <@{member}> さんです :sparkles:" | |
slack_client.api_call( | |
api_method="chat.postMessage", json={"channel": channel, "text": reply} | |
) | |
def specify_speakers(event, context): | |
if jpholiday.is_holiday(date.today()): | |
return | |
chosen_members = random.sample(members, 1) | |
mention_marks = [f"<@{member}>" for member in chosen_members] | |
reply = f'今日の雑談担当者は、 {" ".join(mention_marks)} です :loudspeaker:' | |
slack_client.api_call( | |
api_method="chat.postMessage", json={"channel": channel, "text": reply} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment