-
Notifications
You must be signed in to change notification settings - Fork 6
/
duinocoin.sh
40 lines (34 loc) · 1.2 KB
/
duinocoin.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
/bin/ping -c2 "1.1.1.1" >/dev/null 2>&1
if [ $? -ne 0 ]; then
exit 1
else
unset $BALANCE
unset $WORKERS
unset $NUMBER_WORKERS
unset $BANNER
TOKEN="YOUR_TOKEN"
CHATID="YOUR_CHATID"
WALLET="YOUR_USER_WALLET"
api_telegram="https://api.telegram.org/bot$TOKEN/sendMessage?parse_mode=HTML"
api_duinocoin=$(curl -s -X GET https://server.duinocoin.com/users/$WALLET -H "Accept: application/json" | jq .)
BALANCE=$(echo $api_duinocoin | jq '.result.balance.balance')
BALANCE_FORMAT=$(echo "scale=2; $BALANCE/1" | bc -l)
WORKERS=$(echo $api_duinocoin | jq '.result.miners' | jq '.[].identifier' | tr -d '"')
NUMBER_WORKERS=$(echo $api_duinocoin | jq -r '.result.miners' | jq -r '.[].identifier' | wc -l)
function sendMessage() {
curl -s -X POST $api_telegram -d chat_id=$CHATID -d text="$(printf "<b>$BANNER</b>\n\n \
Balance: $BALANCE_FORMAT\n \
Nº Workers $NUMBER_WORKERS\n \
Names workers:\n<code>$WORKERS</code>")" >/dev/null 2>&1
}
if [ $NUMBER_WORKERS -ne 0 ]; then
BANNER="ᕲ DuinoCoin ✅"
sendMessage
exit 0
else
BANNER="ᕲ DuinoCoin ❌"
sendMessage
exit 1
fi
fi