added check with server queries, added discord webhook

This commit is contained in:
Philipp 2022-10-07 10:39:18 +02:00 committed by Gitea
parent 68bcfec868
commit 1687acd00f
Signed by: Forgejo
GPG key ID: 5A09F9506519E10A

View file

@ -1,11 +1,6 @@
#!/bin/bash
token=$(<.token)
git_username="spenny.tf"
git_repo="tf2-servers"
version=$(<version.txt)
version=`curl -s "https://ql.syncore.org/api/query?hosts=88.198.49.46%3A27015" | jq -r .servers[0].info.serverVersion`
up_to_date=`curl -s "https://api.steampowered.com/ISteamApps/UpToDateCheck/v1/?appid=440&version=${version}" | jq -r .response.up_to_date`
@ -15,6 +10,5 @@ then
else
new_version=`curl -s "https://api.steampowered.com/ISteamApps/UpToDateCheck/v1/?appid=440&version=${version}" | jq -r .response.required_version`
echo "There has been an update, server version: ${version}, newest version: ${new_version}"
echo $new_version > version.txt
curl -X POST https://drone.boehm.sh/api/repos/$git_username/$git_repo/builds -H "Authorization: Bearer $token"
curl -H "Content-Type: application/json" -d '{"username": "Server Version", "content": "There has been an update, server version: ${version}, newest version: ${new_version}"}' "https://discord.com/api/webhooks/1027862143871221770/iK9CAShzV5nrVW_k7m9fouHa5EIOPoXCOofCp7ap9JYEKgmlYgaIgf3NJ2YFb_wy-Y7s"
fi