forked from tilderadio/radiobot
toot about new djs!
This commit is contained in:
parent
400afc4afe
commit
8cf2efc0ed
|
@ -0,0 +1,4 @@
|
||||||
|
toot.json
|
||||||
|
log.txt
|
||||||
|
.bot.cfg
|
||||||
|
|
12
bot.sh
12
bot.sh
|
@ -3,11 +3,16 @@
|
||||||
. bot.properties
|
. bot.properties
|
||||||
input=".bot.cfg"
|
input=".bot.cfg"
|
||||||
now_playing=$(<$now_playing_file)
|
now_playing=$(<$now_playing_file)
|
||||||
|
dj=$(parse_dj)
|
||||||
echo "Starting session: $(date "+[%y:%m:%d %T]")">$log
|
echo "Starting session: $(date "+[%y:%m:%d %T]")">$log
|
||||||
echo "NICK $nick" > $input
|
echo "NICK $nick" > $input
|
||||||
echo "USER $user" >> $input
|
echo "USER $user" >> $input
|
||||||
echo "JOIN #$channel" >> $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
|
tail -f $input | telnet $server $port | while read res
|
||||||
do
|
do
|
||||||
# log the session
|
# log the session
|
||||||
|
@ -19,6 +24,13 @@ do
|
||||||
echo "PRIVMSG #tilderadio :$now_playing" >> $input
|
echo "PRIVMSG #tilderadio :$now_playing" >> $input
|
||||||
fi
|
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
|
# do things when you see output
|
||||||
case "$res" in
|
case "$res" in
|
||||||
# respond to ping requests from the server
|
# respond to ping requests from the server
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"client_id": "",
|
||||||
|
"client_secret": "",
|
||||||
|
"access_token": "",
|
||||||
|
"base_url": "https://tilde.zone"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue