Fixed telegram message sending

This commit is contained in:
Sayantan Santra 2023-04-02 00:15:37 -05:00
parent 1f58ed3175
commit d3083a6d48

View file

@ -233,23 +233,24 @@ $YTM_NONROOT && build_ytm_nonroot
$YTM_ROOT && build_ytm_root $YTM_ROOT && build_ytm_root
# Send telegram message about the new build # Send telegram message about the new build
echo "Sending messages to telegram"
if $TG_UPLOAD; then if $TG_UPLOAD; then
echo "Uploading to telegram"
# telegram-upload uses personal account, hence bypassing 50 MB max upload limit of bots # 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!" [ "$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 /home/sintan/.local/bin/telegram-upload YouTube_ReVanced_nonroot_$timestamp.apk YouTube_Music_ReVanced_nonroot_$timestamp.apk --to "$CHANNEL_ADDRESS" --caption "" && sent=true
fi fi
if $TG_NOTIFICATIONS; then if $TG_NOTIFICATIONS; then
echo "Sending messages to telegram"
# telegram.sh uses bot account, but it supports formatted messages # telegram.sh uses bot account, but it supports formatted messages
[[ "$TELEGRAM_TOKEN" == "" || "$TELEGRAM_CHAT" == "" ]] && echo "Please provide valid channel address in the settings!" [[ "$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/" | 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/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 sed "s/cli/CLI/" | sed "s/integrations/Integrations/" | awk 1 ORS=$'\n') # I know, it's a hacky solution
# [ $sent ] && # [ $sent ] &&
./telegram.sh -T "⚙⚙⚙ Build Details ⚙⚙⚙" -M "$msg"$'\n'"Timestamp: $timestamp"$'\n'"⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯" -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 -M "_An update of microg was published._" -t "$TELEGRAM_TOKEN" -c "$TELEGRAM_CHAT" [ $microg_updated ] && ./telegram.sh -t "$TELEGRAM_TOKEN" -c "$TELEGRAM_CHAT" -M "_An update of microg was published._"
fi fi
# Do some cleanup, keep only the last 3 build's worth of files and a week worth of logs # Do some cleanup, keep only the last 3 build's worth of files and a week worth of logs