Created
November 2, 2020 13:22
-
-
Save blackout314/bbaaf6c9c348414f15d02827a97c3d7a to your computer and use it in GitHub Desktop.
check when new magpi issue go out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TGAPI='TELEGRAM_BOT_API' | |
CHATID='CHAT_ID' | |
ISSUE=`cat MagPiIssue.txt` | |
RES=`curl --write-out "%{http_code}\n" --silent --output /dev/null https://magpi.raspberrypi.org/issues/$ISSUE/pdf` | |
if [ "$RES" -eq 200 ]; | |
then | |
echo "$((ISSUE+1))" > MagPiIssue.txt | |
echo $RES | |
curl -X POST \ | |
-H 'Content-Type: application/json' \ | |
-d '{"chat_id": "'"$CHATID"'", "text": "[TheMagPi] New Issue https://magpi.raspberrypi.org/issues/'"$ISSUE"'/pdf", "disable_notification": true}' \ | |
https://api.telegram.org/bot$TGAPI/sendMessage | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment