From 08145915e54df5e61925c1ce35d8f7c743d3f813 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 14 May 2021 00:56:23 +0500 Subject: [PATCH] bml-tg-notify moved to new repo --- bml-tg-notify/README.md | 21 +------------ bml-tg-notify/bml-tg-notify.sh | 54 ---------------------------------- bml-tg-notify/delay | 1 - bml-tg-notify/env.sample | 6 ---- 4 files changed, 1 insertion(+), 81 deletions(-) delete mode 100755 bml-tg-notify/bml-tg-notify.sh delete mode 100644 bml-tg-notify/delay delete mode 100644 bml-tg-notify/env.sample diff --git a/bml-tg-notify/README.md b/bml-tg-notify/README.md index d463b86..a9be8d4 100644 --- a/bml-tg-notify/README.md +++ b/bml-tg-notify/README.md @@ -2,23 +2,4 @@ ## Receive telegram notification when you receive money to your BML Account -### Requriements -`curl` `jq` -- Install with whatever package manager you use. - -### Setup -``` -curl https://raw.githubusercontent.com/shihaamabr/sarmic/master/bml-tg-notify/bml-tg-notify.sh > bml-tg-notify.sh -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.\ -Please note that if the XX value is less than a certain value, you could get rate limited. - -``` -chmod +x bml-tg-notify.sh -./bml-tg-notify.sh -``` - -### Bugs -- You tell me :) +[MOVE TO NEW REPO](https://github.com/shihaamabr/bml-tg-notify) diff --git a/bml-tg-notify/bml-tg-notify.sh b/bml-tg-notify/bml-tg-notify.sh deleted file mode 100755 index ade6145..0000000 --- a/bml-tg-notify/bml-tg-notify.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -source .env -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 - -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 -else - echo Something went wrong.. Probably your account locked or wrong username password OR your IP Blocked by CF - exit -fi - -CHECKDIFF1=$(echo $HISTORY | wc -c) -HISTORY=$(curl -s -b $COOKIE $BML_URL/account/$BML_ACCOUNTID/history/today | jq -r '.payload | .history | .[]') -CHECKDIFF2=$(echo $HISTORY | wc -c) -DELAY=$(cat delay) - -if [ "$CHECKDIFF1" != "$CHECKDIFF2" ] -then - DESCRIPTION=$(echo $HISTORY | jq -r .description | head -n1) - AMOUNT=$(echo $HISTORY | jq -r .amount | head -n1) - if [ "$DESCRIPTION" = "Transfer Credit" ] - then - FROMTO=From - ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1) - elif [ "$DESCRIPTION" = "Transfer Debit" ] - then - FROMTO=To - ENTITY=$(echo $HISTORY | jq -r .narrative3 | head -n1) - elif [ "$DESCRIPTION" = "Salary" ] - then - FROMTO=From - ENTITY=$(echo $HISTORY | jq -r .narrative2 | head -n1) - fi - echo $DESCRIPTION - echo $FROMTO: $ENTITY - echo $CURRENCY: $AMOUNT - DESCRIPTION=`echo $DESCRIPTION | sed "s/ /%20/g"` #Fix spaces - ENTITY=`echo $ENTITY | sed "s/ /%20/g"` #Fix spaces - TGTEXT=$(echo $DESCRIPTION%0A$FROMTO:%20$ENTITY%0A$CURRENCY:%20$AMOUNT) - curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT > /dev/null - echo "Next check in $DELAY seconds" -else - echo "nothing new..checking again in $DELAY seconds" -fi -sleep $DELAY -done diff --git a/bml-tg-notify/delay b/bml-tg-notify/delay deleted file mode 100644 index 7273c0f..0000000 --- a/bml-tg-notify/delay +++ /dev/null @@ -1 +0,0 @@ -25 diff --git a/bml-tg-notify/env.sample b/bml-tg-notify/env.sample deleted file mode 100644 index 1869676..0000000 --- a/bml-tg-notify/env.sample +++ /dev/null @@ -1,6 +0,0 @@ -BML_USERNAME='' -BML_PASSWORD='' -BML_ACCOUNTID='' -CURRENCY='MVR' -TG_BOT_TOKEN='' -TG_CHATID=''