From f22bbcdd46fb1fa249c2dc681ed3559159ab48bc Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 9 Sep 2021 00:26:24 +0500 Subject: [PATCH] dont need to enter currency in .env now --- bml-tg-notify.sh | 9 ++++++++- env.sample | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bml-tg-notify.sh b/bml-tg-notify.sh index 42f8835..e86607d 100755 --- a/bml-tg-notify.sh +++ b/bml-tg-notify.sh @@ -15,6 +15,13 @@ PROFILE=$(curl -s -b $COOKIE $BML_URL/profile | jq -r '.payload | .profile | .[] curl -s -b $COOKIE $BML_URL/profile --data-raw profile=$PROFILE # select Personal Profile } +getaccountdetails(){ +REQACCOUNTDETAILS=$(curl -s -b $COOKIE $BML_URL/account/$BML_ACCOUNTID | jq -r .payload) +ACCOUNTTYPE=$(echo $REQACCOUNTDETAILS | jq -r .product) +ACCOUNTNUMBER=$(echo $REQACCOUNTDETAILS | jq -r .accountNumber) +CURRENCY=$(echo $REQACCOUNTDETAILS | jq -r .currency) +} + send_tg(){ TGTEXT=$(echo $DESCRIPTION%0A$FROMTOAT: $ENTITY%0A$CURRENCY: $AMOUNT | sed "s/ /%20/g") ; echo $TGTEXT # format text for telegram curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT #send to telegram @@ -43,7 +50,7 @@ echo "Nothing new....Next check in $DELAY seconds" init login - +getaccountdetails loop(){ while true; do diff --git a/env.sample b/env.sample index 4a482b3..90fcad4 100644 --- a/env.sample +++ b/env.sample @@ -2,7 +2,7 @@ BML_USERNAME='' #Your BML Username BML_PASSWORD='' #Your BML Password BML_ACCOUNTID='' #Your BML Account ID,NOT to be confused with account number, read the README.md on how to obtain this. -CURRENCY='MVR' #Change only if your account is USD + TG_BOT_TOKEN='' #Your Telegram Bot API Token, Contact @BotFather on Telegram to obtain token TG_CHATID='' #Your Telegram chat ID, This could be your user, group, supergroup or channel ID, add "-100" first if supergroup or channel