Skip to content

Send shanbay today new words to telegram #2411

Send shanbay today new words to telegram

Send shanbay today new words to telegram #2411

name: Send shanbay today new words to telegram
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
- test
paths:
- shanbay.js
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
TZ: Asia/Shanghai
jobs:
sender:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: agu
run: sudo apt-get update
- name: Setup ffmpeg for differnt platforms
uses: FedericoCarboni/setup-ffmpeg@main
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install package
run: |
npm i
- name: Install edge-tts
run: |
pip install -U edge-tts
- name: Run Script
run: |
node shanbay.js ${{ secrets.TELE_TOKEN }} ${{ secrets.TELE_CHAT_ID }} "${{ secrets.SHANBAY_COOKIE }}"
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "MP3_NEW/1.audio, MP3_REVIEW/1.audio"
- name: use ffmpeg combine and send
id: setup-ffmpeg
run: |
for i in $(ls -1a MP3_NEW/*.audio); do ffmpeg -i $i $i.mp3; done
for i in $(ls -1a MP3_REVIEW/*.audio); do ffmpeg -i $i $i.mp3; done
ffmpeg -y -f concat -safe 0 -i <(find "$(pwd)"/MP3_NEW -iname "*.audio.mp3" -printf "file "%p"\n" | sort -V) -c copy "$(pwd)"/$(date +"%m%d")_new_words.mp3
ffmpeg -y -f concat -safe 0 -i <(find "$(pwd)"/MP3_REVIEW -iname "*.audio.mp3" -printf "file "%p"\n" | sort -V) -c copy "$(pwd)"/$(date +"%m%d")_review_words.mp3
curl -v -F "chat_id=${{ secrets.TELE_CHAT_ID }}" -F document=@$(date +"%m%d")_new_words.mp3 https://api.telegram.org/bot${{ secrets.TELE_TOKEN }}/sendDocument
curl -v -F "chat_id=${{ secrets.TELE_CHAT_ID }}" -F document=@$(date +"%m%d")_review_words.mp3 https://api.telegram.org/bot${{ secrets.TELE_TOKEN }}/sendDocument
curl -v -F "chat_id=${{ secrets.TELE_CHAT_ID }}" -F document=@new_article.mp3 https://api.telegram.org/bot${{ secrets.TELE_TOKEN }}/sendDocument
curl -v -F "chat_id=${{ secrets.TELE_CHAT_ID }}" -F document=@review_article.mp3 https://api.telegram.org/bot${{ secrets.TELE_TOKEN }}/sendDocument
if: steps.check_files.outputs.files_exists == 'true'