fix sending updates if a dj is on

This commit is contained in:
Ben Harris 2020-06-18 00:51:39 -04:00
parent b04e5ac662
commit 7e492f165f
1 changed files with 6 additions and 2 deletions

8
bot.sh
View File

@ -35,14 +35,18 @@ tail -f input.txt | telnet $server $port | while read -r buf
do
# trim \r's
line=$(printf %b "$buf" | tr -d $'\r')
# log the received line
printf "< %s: %s\n" "$(date "+[%y:%m:%d %T]")" "$line"
# now playing
if [ "$now_playing" != "$(<$npfile)" ]; then
now_playing=$(<$npfile)
[ -n "$dj" ] && \
msg "$channel" "\x0303$now_playing"
# print the new song if a dj is streaming
if [ -n "$dj" ]; then
msg "#$channel" "\x0303$now_playing"
fi
fi
# new dj!