toot about new djs!

This commit is contained in:
Ben Harris 2018-10-24 15:47:52 -04:00
parent 400afc4afe
commit 8cf2efc0ed
3 changed files with 23 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
toot.json
log.txt
.bot.cfg

12
bot.sh
View File

@ -3,11 +3,16 @@
. bot.properties
input=".bot.cfg"
now_playing=$(<$now_playing_file)
dj=$(parse_dj)
echo "Starting session: $(date "+[%y:%m:%d %T]")">$log
echo "NICK $nick" > $input
echo "USER $user" >> $input
echo "JOIN #$channel" >> $input
function parse_dj {
echo $now_playing | grep -Eo '^\([^)]*\)' | sed 's/[()]//g'
}
tail -f $input | telnet $server $port | while read res
do
# log the session
@ -19,6 +24,13 @@ do
echo "PRIVMSG #tilderadio :$now_playing" >> $input
fi
if [[ $dj != $(parse_dj) ]]; then
[ -z ${dj+x} ] && continue
dj=$(parse_dj)
echo "PRIVMSG #tilderadio :$dj is now online!" >> $input
TOOT_JSON_PATH=. toot "dj $dj is now streaming live at https://tilderadio.org!"
fi
# do things when you see output
case "$res" in
# respond to ping requests from the server

7
toot.json.sample Normal file
View File

@ -0,0 +1,7 @@
{
"client_id": "",
"client_secret": "",
"access_token": "",
"base_url": "https://tilde.zone"
}