This commit is contained in:
Shihaam Abdul Rahman 2021-05-12 20:34:27 +05:00
parent becbcfbbe7
commit a0d42f6dde
2 changed files with 7 additions and 7 deletions

View File

@ -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 curl https://raw.githubusercontent.com/shihaamabr/sarmic/master/bml-tg-notify/env.sample > .env
``` ```
edit the contents of .env to your config\ Edit the contents of .env to your config\
`echo XX > delay` where XX is the time in seconds you want to delay script run. `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 chmod +x bml-tg-notify.sh

View File

@ -4,13 +4,12 @@ mkdir -p ~/.cache/bml-cli/
TG_BOTAPI='https://api.telegram.org/bot' TG_BOTAPI='https://api.telegram.org/bot'
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api' BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
COOKIE=~/.cache/bml-cli/cookie COOKIE=~/.cache/bml-cli/cookie
SLEEP=120
while true; do while true; do
LOGIN=$(curl -s -c $COOKIE $BML_URL/login --data-raw username=$BML_USERNAME --data-raw password=${BML_PASSWORD} | jq -r .code) LOGIN=$(curl -s -c $COOKIE $BML_URL/login --data-raw username=$BML_USERNAME --data-raw password=${BML_PASSWORD} | jq -r .code)
if [ "$LOGIN" = "0" ] if [ "$LOGIN" = "0" ]
then then
PROFILE=$(curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] | .profile' | head -n 1) 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 curl -s -b $COOKIE $BML_URL/profile --data-raw profile=$PROFILE > /dev/null
else else
echo Something went wrong echo Something went wrong
exit exit
@ -21,7 +20,7 @@ HISTORY=$(curl -s -b $COOKIE $BML_URL/account/$BML_ACCOUNTID/history/today | jq
CHECKDIFF2=$(echo $HISTORY | wc -c) CHECKDIFF2=$(echo $HISTORY | wc -c)
if [ "$CHECKDIFF1" = "$CHECKDIFF2" ] if [ "$CHECKDIFF1" = "$CHECKDIFF2" ]
then then
echo "nothing new..checking again in $SLEEP seconds" echo "nothing new..checking again in $SLEEP seconds"
else else
TRANSFERAMOUNT=$(echo $HISTORY | jq -r .amount | head -n1) TRANSFERAMOUNT=$(echo $HISTORY | jq -r .amount | head -n1)