Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

[WIP] #6 slack reminder #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_service(name, version):
サービスを取得する
"""
credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
http = credentials.authorize(httplib2.Http(cache=".cache"))
service = discovery.build(name, version, http=http)
return service

Expand Down
30 changes: 30 additions & 0 deletions jobs/slack_reminder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import logging
from datetime import datetime

from utils import user, slack, holiday, google_sheets

logger = logging.getLogger(__name__)

# スプレッドシートのID
SHEET_ID = '1u-F1Ixh2s-FBMULHv8w4JrSkQnHsTCG5BjjMQFkWRMU'

def job():
"""
slack-reminderシートに書いてある通知をSlackに送る
"""

logger.info('Start slack-reminder job')

# 休みの日ならなにもしない
if holiday.is_holiday():
return

now = datetime.now()
# 全データを取得
values = google_sheets.get_all_values(SHEET_ID, 'reminder')
for value in values[1:]:
# TODO: コメント行を無視
# TODO: 時間をチェック
# TODO: 日付をチェック
# TODO: メッセージを送信する
print(value)