From a88a6b22e4333e9c9f7762e2f48f41e5cc927519 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 12 May 2021 07:08:31 +0500 Subject: [PATCH] clean up --- bml-tg-notify/bml-tg-notify.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bml-tg-notify/bml-tg-notify.sh b/bml-tg-notify/bml-tg-notify.sh index ac20c6c..296b91c 100755 --- a/bml-tg-notify/bml-tg-notify.sh +++ b/bml-tg-notify/bml-tg-notify.sh @@ -1,11 +1,8 @@ #!/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' - -mkdir -p ~/.cache/bml-cli/ COOKIE=~/.cache/bml-cli/cookie LOGIN=$(curl -s -c $COOKIE $BML_URL/login --data-raw username=$BML_USERNAME --data-raw password=${BML_PASSWORD} | jq -r .code) @@ -19,9 +16,11 @@ else fi while true; do + 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) + if [ "$CHECKDIFF1" = "$CHECKDIFF2" ] then echo nothing new..checking again