diff --git a/bml-tg-notify/README.md b/bml-tg-notify/README.md index 122f9c6..54ece80 100644 --- a/bml-tg-notify/README.md +++ b/bml-tg-notify/README.md @@ -12,8 +12,9 @@ curl https://raw.githubusercontent.com/shihaamabr/sarmic/master/bml-tg-notify/bm curl https://raw.githubusercontent.com/shihaamabr/sarmic/master/bml-tg-notify/env.sample > .env ``` -edit the contents of .env to your config\ -`echo XX > delay` where XX is the time in seconds you want to delay script run. +Edit the contents of .env to your config\ +`echo XX > delay` where XX is the time in seconds you want to delay script run.\ +Please note that if the XX value is less than a certain value, you could get rate limited. ``` chmod +x bml-tg-notify.sh diff --git a/bml-tg-notify/bml-tg-notify.sh b/bml-tg-notify/bml-tg-notify.sh index dfb52f4..beeca5f 100755 --- a/bml-tg-notify/bml-tg-notify.sh +++ b/bml-tg-notify/bml-tg-notify.sh @@ -4,13 +4,12 @@ mkdir -p ~/.cache/bml-cli/ TG_BOTAPI='https://api.telegram.org/bot' BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' COOKIE=~/.cache/bml-cli/cookie -SLEEP=120 while true; do LOGIN=$(curl -s -c $COOKIE $BML_URL/login --data-raw username=$BML_USERNAME --data-raw password=${BML_PASSWORD} | jq -r .code) if [ "$LOGIN" = "0" ] - then - PROFILE=$(curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1) - curl -s -b $COOKIE $BML_URL/profile --data-raw profile=$PROFILE > /dev/null +then + PROFILE=$(curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1) + curl -s -b $COOKIE $BML_URL/profile --data-raw profile=$PROFILE > /dev/null else echo Something went wrong exit @@ -21,7 +20,7 @@ HISTORY=$(curl -s -b $COOKIE $BML_URL/account/$BML_ACCOUNTID/history/today | jq CHECKDIFF2=$(echo $HISTORY | wc -c) if [ "$CHECKDIFF1" = "$CHECKDIFF2" ] - then +then echo "nothing new..checking again in $SLEEP seconds" else TRANSFERAMOUNT=$(echo $HISTORY | jq -r .amount | head -n1)