I wrote a code that check any income messages to telegram bot from you, and answer you.
Save it as separate file and run it at start.
source ~/wallets #import wallets
source ~/settings.sh #import settings
cd /tmp
while [ 1 ]
do
rm getUpdates
wget
https://api.telegram.org/bot$TELEGRAM_API/getUpdates
INCOME=$(cat ./getUpdates | grep $TELEGRAM_CHAT | tail -1 | awk -F ":" '{print $13}' | cut -d \" -f 2)
INCOME_TIME=$(cat ./getUpdates | grep $TELEGRAM_CHAT | tail -1 | awk -F ":" '{print $12}' | cut -c -10)
LAST_INCOME_TIME=$(cat /home/m1/last_inc_time)
if [ $INCOME_TIME != $LAST_INCOME_TIME ]
then
if [[ $INCOME == "State" || $INCOME == "state" || $INCOME == "STATE" ]]
then
echo state of rig
~/mail.sh 9
else
echo invalid msg!
fi
echo $INCOME_TIME > /home/m1/last_inc_time #first time you must create this file yourself. put any numbers inside.
else
echo no new messeges!
fi
sleep 5
done
To change or add new msg: $INCOME is text of message. ~/mail.sh 9 - is command to do.
if [[ $INCOME == "State" || $INCOME == "state" || $INCOME == "STATE" ]]
then
echo state of rig
~/mail.sh 9
else
echo invalid msg!
fi
Please add to nvOC .
I will add this to my update stack.