Created
August 14, 2016 13:58
-
-
Save FiveYellowMice/b34314d17209c30748b2afb7d0428d7d to your computer and use it in GitHub Desktop.
Yoitsu Horo bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Run Yoitsu Horo bot once | |
[Service] | |
Type=oneshot | |
WorkingDirectory=/home/alex/Projects/yoitsuhorobot | |
ExecStart=/home/alex/Projects/yoitsuhorobot/yoitsuhorobot.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rand=$(tr -dc 0-1 < /dev/urandom | head -c1) | |
if [ $rand = 1 ]; then | |
emoji="%F0%9F%98%82" | |
else | |
emoji="%F0%9F%98%8B" | |
fi | |
rand=$(tr -dc 1-5 < /dev/urandom | head -c1) | |
for (( i=0; i<$rand; i++ )); do | |
msg="$msg$emoji" | |
done | |
#echo "$msg" | |
for chat in $(cat chats); do | |
curl "https://api.telegram.org/bot$(cat token)/sendMessage?chat_id=$chat&text=$msg" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Yoitsu Horo bot | |
[Timer] | |
OnActiveSec=5 | |
OnUnitActiveSec=30m | |
RandomizedDelaySec=1h30m | |
[Install] | |
WantedBy=default.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$RANDOM
?