Add 'hash.sh'
This commit is contained in:
parent
9bfc971d2c
commit
edf7bd6ca0
70
hash.sh
Normal file
70
hash.sh
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#############################
|
||||||
|
STATS_MESSAGE="Top Hash Tags on the Fediverse right now:"
|
||||||
|
SLEEP_TIME="21600"
|
||||||
|
BOT_ACCOUNT="hashbot@poster.place"
|
||||||
|
############################
|
||||||
|
#cd /root/docker/blockbot
|
||||||
|
|
||||||
|
getTags() {
|
||||||
|
DATA=$(curl https://fedi.buzz/ | grep -i tags | cut -d '/' -f5 | sed 's/">//' | sort -u | sed 's/^/#/')
|
||||||
|
MESSAGE="$STATS_MESSAGE $DATA"
|
||||||
|
toot activate $BOT_ACCOUNT
|
||||||
|
echo $DATA | toot post
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
background_daemon() {
|
||||||
|
echo
|
||||||
|
echo "HashTag running in Daemon Mode"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
while true; do
|
||||||
|
echo "Current Time: `date`"
|
||||||
|
getTags
|
||||||
|
if [[ `date | cut -d " " -f4` == *"06:00"* ]]; then
|
||||||
|
echo "Checking for new blocks.......";echo
|
||||||
|
getTags
|
||||||
|
fi
|
||||||
|
if [[ `date | cut -d " " -f4` == *"12:00"* ]]; then
|
||||||
|
echo "Checking for new blocks.......";echo
|
||||||
|
getTags
|
||||||
|
fi
|
||||||
|
if [[ `date | cut -d " " -f4` == *"18:00"* ]]; then
|
||||||
|
echo "Checking for new blocks.......";echo
|
||||||
|
getTags
|
||||||
|
fi
|
||||||
|
echo "#######################################"
|
||||||
|
echo "Sleeping for 30 seconds........."
|
||||||
|
echo "#######################################"
|
||||||
|
sleep 30
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
background(){
|
||||||
|
if [[ `date` == *":00"* ]]; then
|
||||||
|
background_daemon
|
||||||
|
else
|
||||||
|
echo "Waiting for time to be in sync...."
|
||||||
|
sleep 1
|
||||||
|
background
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
echo
|
||||||
|
echo "hash.sh daemon"
|
||||||
|
echo
|
||||||
|
echo "hash.sh print"
|
||||||
|
echo "hash.sh help"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$1" = "daemon" ]; then
|
||||||
|
background
|
||||||
|
elif [ "$1" = "blocks" ]; then
|
||||||
|
print "$2"
|
||||||
|
else
|
||||||
|
help
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user