From cc1c6bd8245f6f766f2d3598ef87eacb61cbf631 Mon Sep 17 00:00:00 2001 From: XelXen <78258352+XelXen@users.noreply.github.com> Date: Sun, 12 Jun 2022 23:11:49 +0530 Subject: [PATCH] New format --- .github/tg.py | 16 +++++++++++++++- .github/workflows/tg-bot.yml | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/tg.py b/.github/tg.py index c8ca6758e..793cd056b 100644 --- a/.github/tg.py +++ b/.github/tg.py @@ -1,10 +1,24 @@ import telegram from tgconfig import TG_TOKEN +from json import load +from time import sleep + +f = open('commit.json') +data = load(f) + +title = f'''*Libretube {data['sha'][0:7]} // Alpha* + +{data['commit']['message']} + +Signed-off-by: {data['commit']['author']['name']} <{data['commit']['author']['email']}> +''' + +f.close() TG_CHAT_ID = "-1001537505605" bot = telegram.Bot(TG_TOKEN) -bot.send_photo(TG_CHAT_ID, open('space.png', 'rb')) +bot.send_photo(TG_CHAT_ID, open('alpha.png', 'rb'), title, telegram.ParseMode.MARKDOWN) bot.send_document(TG_CHAT_ID, open('app-arm64-v8a-debug.apk', 'rb')) bot.send_document(TG_CHAT_ID, open('app-armeabi-v7a-debug.apk', 'rb')) bot.send_document(TG_CHAT_ID, open('app-x86_64-debug.apk', 'rb')) diff --git a/.github/workflows/tg-bot.yml b/.github/workflows/tg-bot.yml index 2f91b0968..7ca78bb81 100644 --- a/.github/workflows/tg-bot.yml +++ b/.github/workflows/tg-bot.yml @@ -34,8 +34,9 @@ jobs: run: | mv app/build/outputs/apk/debug/*.apk .github/ cd .github - curl https://libre-tube.github.io/assets/LibreSpace.png --output space.png + curl https://libre-tube.github.io/assets/LibreAlpha.png --output alpha.png echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py + curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json python -m pip install --upgrade pip pip install python-telegram-bot python tg.py