From d3083a6d48d2f30d4e88433ab4d016892471fca0 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sun, 2 Apr 2023 00:15:37 -0500 Subject: [PATCH] Fixed telegram message sending --- build_revanced.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build_revanced.sh b/build_revanced.sh index b43e87d..4b2f06f 100755 --- a/build_revanced.sh +++ b/build_revanced.sh @@ -233,23 +233,24 @@ $YTM_NONROOT && build_ytm_nonroot $YTM_ROOT && build_ytm_root # Send telegram message about the new build -echo "Sending messages to telegram" if $TG_UPLOAD; then + echo "Uploading to telegram" # telegram-upload uses personal account, hence bypassing 50 MB max upload limit of bots [ "$CHANNEL_ADDRESS" == "" ] && echo "Please provide valid channel address in the settings!" /home/sintan/.local/bin/telegram-upload YouTube_ReVanced_nonroot_$timestamp.apk YouTube_Music_ReVanced_nonroot_$timestamp.apk --to "$CHANNEL_ADDRESS" --caption "" && sent=true fi if $TG_NOTIFICATIONS; then + echo "Sending messages to telegram" # telegram.sh uses bot account, but it supports formatted messages [[ "$TELEGRAM_TOKEN" == "" || "$TELEGRAM_CHAT" == "" ]] && echo "Please provide valid channel address in the settings!" msg=$(cat versions.json | tail -n+2 | head -n-1 | cut -c3- | sed "s/\"//g" | sed "s/,//g" | sed "s/com.google.android.apps.youtube.music/YouTube Music/" | sed "s/com.google.android.youtube/YouTube/" | sed "s/VancedMicroG/Vanced microG/" | sed "s/revanced-/ReVanced /g" | sed "s/patches/Patches/" | sed "s/cli/CLI/" | sed "s/integrations/Integrations/" | awk 1 ORS=$'\n') # I know, it's a hacky solution # [ $sent ] && - ./telegram.sh -T "⚙⚙⚙ Build Details ⚙⚙⚙" -M "$msg"$'\n'"Timestamp: $timestamp"$'\n'"⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯" -t "$TELEGRAM_TOKEN" -c "$TELEGRAM_CHAT" - [ $microg_updated ] && ./telegram.sh -M "_An update of microg was published._" -t "$TELEGRAM_TOKEN" -c "$TELEGRAM_CHAT" + ./telegram.sh -t "$TELEGRAM_TOKEN" -c "$TELEGRAM_CHAT" -T "⚙⚙⚙ Build Details ⚙⚙⚙" -M "$msg"$'\n'"Timestamp: $timestamp"$'\n'"⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯" + [ $microg_updated ] && ./telegram.sh -t "$TELEGRAM_TOKEN" -c "$TELEGRAM_CHAT" -M "_An update of microg was published._" fi # Do some cleanup, keep only the last 3 build's worth of files and a week worth of logs