diff --git a/.github/workflows/get_prediction.yml b/.github/workflows/get_prediction.yml index 1a5897f..a20dba0 100644 --- a/.github/workflows/get_prediction.yml +++ b/.github/workflows/get_prediction.yml @@ -2,84 +2,51 @@ name: Get Prediction on: schedule: - - cron: "03 16 * * *" + - cron: "50 16 * * *" jobs: send-message: runs-on: ubuntu-latest steps: - - name: Send message to LINE + - name: Send message to LINE Notify env: - LINE_ACCESS_TOKEN: ${{ secrets.LINE_CHANNEL_ACCESS_TOKEN }} - LINE_USER_ID: ${{ secrets.LINE_USER_ID }} + LINE_NOTIFY_TOKEN: ${{ secrets.LINE_NOTIFY_TOKEN }} run: | - curl -X POST https://api.line.me/v2/bot/message/push \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ - -d '{ - "to": "'$LINE_USER_ID'", - "messages":[ - { - "type":"text", - "text":"喚醒 Line 機器人" - } - ] - }' + # First message + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=喚醒 Line 機器人" sleep 300 - curl -X POST https://api.line.me/v2/bot/message/push \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ - -d '{ - "to": "'$LINE_USER_ID'", - "messages":[ - { - "type":"text", - "text":"NBA thismonth 30" - }, - { - "type":"text", - "text":"NBA lastmonth 30" - } - ] - }' + # Second message + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=NBA thismonth 30" + + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=NBA lastmonth 30" sleep 60 - curl -X POST https://api.line.me/v2/bot/message/push \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ - -d '{ - "to": "'$LINE_USER_ID'", - "messages":[ - { - "type":"text", - "text":"NHL冰球 thismonth 30" - }, - { - "type":"text", - "text":"NHL冰球 lastmonth 30" - } - ] - }' + # Third message + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=NHL冰球 thismonth 30" + + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=NHL冰球 lastmonth 30" sleep 60 - curl -X POST https://api.line.me/v2/bot/message/push \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ - -d '{ - "to": "'$LINE_USER_ID'", - "messages":[ - { - "type":"text", - "text":"MLB thismonth 30" - }, - { - "type":"text", - "text":"MLB lastmonth 30" - } - ] - }' + # Fourth message + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=MLB thismonth 30" + + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=MLB lastmonth 30" diff --git a/.github/workflows/get_prediction_linebot.yml b/.github/workflows/get_prediction_linebot.yml new file mode 100644 index 0000000..c5a4dfe --- /dev/null +++ b/.github/workflows/get_prediction_linebot.yml @@ -0,0 +1,86 @@ +# 測試中錯誤的版本,這是 line 機器人主動發訊息給自己,我要的是反過來 +name: Get Prediction + +# on: +# schedule: +# - cron: "03 16 * * *" + +jobs: + send-message: + runs-on: ubuntu-latest + + steps: + - name: Send message to LINE + env: + LINE_ACCESS_TOKEN: ${{ secrets.LINE_CHANNEL_ACCESS_TOKEN }} + LINE_USER_ID: ${{ secrets.LINE_USER_ID }} + run: | + curl -X POST https://api.line.me/v2/bot/message/push \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ + -d '{ + "to": "'$LINE_USER_ID'", + "messages":[ + { + "type":"text", + "text":"喚醒 Line 機器人" + } + ] + }' + + sleep 300 + + curl -X POST https://api.line.me/v2/bot/message/push \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ + -d '{ + "to": "'$LINE_USER_ID'", + "messages":[ + { + "type":"text", + "text":"NBA thismonth 30" + }, + { + "type":"text", + "text":"NBA lastmonth 30" + } + ] + }' + + sleep 60 + + curl -X POST https://api.line.me/v2/bot/message/push \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ + -d '{ + "to": "'$LINE_USER_ID'", + "messages":[ + { + "type":"text", + "text":"NHL冰球 thismonth 30" + }, + { + "type":"text", + "text":"NHL冰球 lastmonth 30" + } + ] + }' + + sleep 60 + + curl -X POST https://api.line.me/v2/bot/message/push \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ + -d '{ + "to": "'$LINE_USER_ID'", + "messages":[ + { + "type":"text", + "text":"MLB thismonth 30" + }, + { + "type":"text", + "text":"MLB lastmonth 30" + } + ] + }' diff --git a/.github/workflows/get_result.yml b/.github/workflows/get_result.yml index 56ef89b..75d6e8f 100644 --- a/.github/workflows/get_result.yml +++ b/.github/workflows/get_result.yml @@ -9,65 +9,28 @@ jobs: runs-on: ubuntu-latest steps: - - name: Send message to LINE + - name: Send message to LINE Notify env: - LINE_ACCESS_TOKEN: ${{ secrets.LINE_CHANNEL_ACCESS_TOKEN }} - LINE_USER_ID: ${{ secrets.LINE_USER_ID }} + LINE_NOTIFY_TOKEN: ${{ secrets.LINE_NOTIFY_TOKEN }} run: | - curl -X POST https://api.line.me/v2/bot/message/push \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ - -d '{ - "to": "'$LINE_USER_ID'", - "messages":[ - { - "type":"text", - "text":"喚醒 Line 機器人" - } - ] - }' + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=喚醒 Line 機器人" sleep 300 - curl -X POST https://api.line.me/v2/bot/message/push \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ - -d '{ - "to": "'$LINE_USER_ID'", - "messages":[ - { - "type":"text", - "text":"NBA yesterday 20" - } - ] - }' + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=NBA yesterday 20" sleep 60 - curl -X POST https://api.line.me/v2/bot/message/push \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ - -d '{ - "to": "'$LINE_USER_ID'", - "messages":[ - { - "type":"text", - "text":"NHL冰球 yesterday 20" - } - ] - }' + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=NHL冰球 yesterday 20" sleep 60 - curl -X POST https://api.line.me/v2/bot/message/push \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ - -d '{ - "to": "'$LINE_USER_ID'", - "messages":[ - { - "type":"text", - "text":"MLB yesterday 20" - } - ] - }' + curl -X POST https://notify-api.line.me/api/notify \ + -H "Authorization: Bearer $LINE_NOTIFY_TOKEN" \ + -F "message=MLB yesterday 20" diff --git a/.github/workflows/get_result_linebot.yml b/.github/workflows/get_result_linebot.yml new file mode 100644 index 0000000..b802b3a --- /dev/null +++ b/.github/workflows/get_result_linebot.yml @@ -0,0 +1,75 @@ +# 測試中錯誤的版本,這是 line 機器人主動發訊息給自己,我要的是反過來 +name: Get Result + +# on: +# schedule: +# - cron: "46 13 * * *" + +jobs: + send-message: + runs-on: ubuntu-latest + + steps: + - name: Send message to LINE + env: + LINE_ACCESS_TOKEN: ${{ secrets.LINE_CHANNEL_ACCESS_TOKEN }} + LINE_USER_ID: ${{ secrets.LINE_USER_ID }} + LINE_NOTIFY_TOKEN: ${{ secrets.LINE_NOTIFY_TOKEN }} + run: | + curl -X POST https://api.line.me/v2/bot/message/push \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ + -d '{ + "to": "'$LINE_USER_ID'", + "messages":[ + { + "type":"text", + "text":"喚醒 Line 機器人" + } + ] + }' + + sleep 300 + + curl -X POST https://api.line.me/v2/bot/message/push \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ + -d '{ + "to": "'$LINE_USER_ID'", + "messages":[ + { + "type":"text", + "text":"NBA yesterday 20" + } + ] + }' + + sleep 60 + + curl -X POST https://api.line.me/v2/bot/message/push \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ + -d '{ + "to": "'$LINE_USER_ID'", + "messages":[ + { + "type":"text", + "text":"NHL冰球 yesterday 20" + } + ] + }' + + sleep 60 + + curl -X POST https://api.line.me/v2/bot/message/push \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $LINE_ACCESS_TOKEN" \ + -d '{ + "to": "'$LINE_USER_ID'", + "messages":[ + { + "type":"text", + "text":"MLB yesterday 20" + } + ] + }'