diff --git a/README.md b/README.md index 9ce6f74..9ee47df 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Getting started. ### Requirements -`curl` `screen` +`curl` `jq` `screen` - Install with whatever package manager you use. - Make SURE they are installed before continuing! ### Clone repo and Configure diff --git a/bml-status-tg-bot b/bml-status-tg-bot index f847f87..8143f44 100755 --- a/bml-status-tg-bot +++ b/bml-status-tg-bot @@ -4,21 +4,8 @@ while true; do source .env COUNT=$(echo $[$COUNT+1]) - STATUS=$(curl -si $BML_URL/login \ - -H 'authority: www.bankofmaldives.com.mv' \ - -H 'cache-control: max-age=0' \ - -H 'upgrade-insecure-requests: 1' \ - -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36' \ - -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ - -H 'sec-gpc: 1' \ - -H 'sec-fetch-site: none' \ - -H 'sec-fetch-mode: navigate' \ - -H 'sec-fetch-user: ?1' \ - -H 'sec-fetch-dest: document' \ - -H 'accept-language: en-US,en;q=0.9' \ - -H "cookie: cf_clearance=${CF_CLEARANCE};" \ - --compressed | head -n1 | awk '{print $2}') - if [ "$STATUS" = "200" ] + STATUS=$(curl -si $BML_URL/login | jq .code) + if [ "$STATUS" = "0" ] then TEXT="🟢BML Online" else @@ -29,7 +16,7 @@ source .env STATUS_OLD=$STATUS if [ "$COUNT" != "1" ] then - TGTEXT=$(echo Status: $TEXT%0ACode: HTTP $STATUS | sed "s/ /%20/g") + TGTEXT=$(echo Status: $TEXT | sed "s/ /%20/g") curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=${TGTEXT} fi fi