works i guess
This commit is contained in:
parent
e04ab97beb
commit
667f7f0cd5
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.env
|
.env
|
||||||
.cookie
|
.cookie
|
||||||
.*.kate-swp
|
.*.kate-swp
|
||||||
|
.cache/*
|
||||||
|
46
bml-status-tg-bot.sh
Normal file → Executable file
46
bml-status-tg-bot.sh
Normal file → Executable file
@ -1,28 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source .env
|
source .env
|
||||||
|
|
||||||
LOGIN=$(curl -s -c $COOKIE $BML_URL/login \
|
while true;
|
||||||
--data-raw username=$BML_USERNAME \
|
do
|
||||||
--data-raw password=${BML_PASSWORD} \
|
|
||||||
| jq -r .code)
|
|
||||||
if [ "$LOGIN" = "0" ]
|
|
||||||
then
|
|
||||||
echo Login success
|
|
||||||
elif [ "$LOGIN" = "20" ]
|
|
||||||
then
|
|
||||||
sleep 1.5
|
|
||||||
echo Account Locked!
|
|
||||||
echo Please reset password and login again.
|
|
||||||
elif [ "$LOGIN" = "2" ]
|
|
||||||
then
|
|
||||||
echo Password or Username Incorrect
|
|
||||||
elif [ "$LOGIN" = "37" ]
|
|
||||||
then
|
|
||||||
echo Down for Maintenance
|
|
||||||
echo Try again later
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
echo Unknown Error
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
STATUS=$(curl -s $BML_URL/login | jq .code)
|
||||||
|
if [ "$STATUS" = "0" ]
|
||||||
|
then
|
||||||
|
TGTEXT="BML%20Online"
|
||||||
|
elif [ "$STATUS" = "37" ]
|
||||||
|
then
|
||||||
|
TGTEXT="BML%20Down"
|
||||||
|
else
|
||||||
|
TGTEXT="Unknown%20Error"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$STATUS" != "$STATUS_OLD" ]
|
||||||
|
then
|
||||||
|
STATUS_OLD=$STATUS
|
||||||
|
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep $DELAY
|
||||||
|
done
|
||||||
|
19
env.example
19
env.example
@ -1,5 +1,16 @@
|
|||||||
BML_USERNAME=
|
# EDIT THESE TO YOUR CONFIG
|
||||||
BML_PASSWORD=
|
# BML Config
|
||||||
|
BML_USERNAME='' #Your BML Username
|
||||||
|
BML_PASSWORD='' #Your BML Password
|
||||||
|
|
||||||
BML_URL=https://www.bankofmaldives.com.mv/internetbanking/api
|
# Delays
|
||||||
COOKIE=.cookie
|
DELAY='120' # Delay in seconds for script to check for new transactions
|
||||||
|
|
||||||
|
# Telegram Config
|
||||||
|
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
|
||||||
|
|
||||||
|
# DO NOT EDIT THESE UNLESS YOU KNOW WHAT YOURE DOING
|
||||||
|
COOKIE=.cache/cookie
|
||||||
|
TG_BOTAPI='https://api.telegram.org/bot'
|
||||||
|
BML_URL='https://www.bankofmaldives.com.mv/internetbanking/api'
|
||||||
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 631 B |
Loading…
x
Reference in New Issue
Block a user