Skip to content

Instantly share code, notes, and snippets.

@blackout314
Created November 2, 2020 13:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackout314/bbaaf6c9c348414f15d02827a97c3d7a to your computer and use it in GitHub Desktop.
Save blackout314/bbaaf6c9c348414f15d02827a97c3d7a to your computer and use it in GitHub Desktop.
check when new magpi issue go out
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