add now playing to announcements
This commit is contained in:
parent
97468cd6a2
commit
7e856523fa
25
bot.sh
25
bot.sh
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
. bot.properties
|
. bot.properties
|
||||||
input=".bot.cfg"
|
input=".bot.cfg"
|
||||||
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 $nick 0 * :$nick" >> $input
|
echo "USER $nick 0 * :$nick" >> $input
|
||||||
echo "MODE $nick +B" >> $input
|
echo "MODE $nick +B" >> $input
|
||||||
|
@ -20,7 +20,7 @@ function msg {
|
||||||
echo "PRIVMSG ${1} :${2}" >> $input
|
echo "PRIVMSG ${1} :${2}" >> $input
|
||||||
}
|
}
|
||||||
|
|
||||||
# save info
|
# save info on startup
|
||||||
save_info
|
save_info
|
||||||
dj=$(parse_dj)
|
dj=$(parse_dj)
|
||||||
|
|
||||||
|
@ -30,20 +30,29 @@ do
|
||||||
# log the session
|
# log the session
|
||||||
echo "$(date "+[%y:%m:%d %T]")$res" >> $log
|
echo "$(date "+[%y:%m:%d %T]")$res" >> $log
|
||||||
|
|
||||||
|
# now playing
|
||||||
|
if [[ $now_playing != "$(<$npfile)" ]]; then
|
||||||
|
save_info
|
||||||
|
[[ ! -z "${dj}" ]] && echo -e "PRIVMSG #$channel :\x0303$now_playing" >> $input
|
||||||
|
fi
|
||||||
|
|
||||||
# new dj!
|
# new dj!
|
||||||
if [[ $dj != $(parse_dj) ]]; then
|
if [[ $dj != $(parse_dj) ]]; then
|
||||||
dj=$(parse_dj)
|
dj=$(parse_dj)
|
||||||
if [[ ! -z "${dj}" ]]; then
|
if [[ ! -z "${dj}" ]]; then
|
||||||
for chan in $notify_channels; do
|
for chan in $notify_channels; do
|
||||||
msg "#$chan" "$dj is now online! tune in now here: $link"
|
msg "#$chan" "$dj is now online playing $now_playing! tune in now here: $link"
|
||||||
done
|
done
|
||||||
|
|
||||||
while read -u 10 subscriber; do
|
while read -u 10 subscriber; do
|
||||||
msg $subscriber "$dj is now online! tune in now here: $link"
|
msg $subscriber "$dj is now online playing $now_playing! tune in now here: $link"
|
||||||
done 10< subscribers.txt
|
done 10< subscribers.txt
|
||||||
|
|
||||||
while read -u 11 subscriber email_addr; do
|
while read -u 11 subscriber email_addr; do
|
||||||
sed -e "s/<dj>/$dj/g" -e "s|<link>|$link|g" dj-online-email.tmpl \
|
sed -e "s/<dj>/$dj/g" \
|
||||||
|
-e "s|<link>|$link|g" \
|
||||||
|
-e "s/<now_playing>/$now_playing/g" \
|
||||||
|
-e "s/<email_addr>/$email_addr/g" dj-online-email.tmpl \
|
||||||
| sendmail $email_addr
|
| sendmail $email_addr
|
||||||
done 11< email-subscribers.txt
|
done 11< email-subscribers.txt
|
||||||
|
|
||||||
|
@ -53,12 +62,6 @@ do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# now playing
|
|
||||||
if [[ $now_playing != "$(<$npfile)" ]]; then
|
|
||||||
save_info
|
|
||||||
[[ ! -z "${dj}" ]] && echo -e "PRIVMSG #$channel :\x0303$now_playing" >> $input
|
|
||||||
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
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
From: radiobot <radiobot@tilde.chat>
|
From: radiobot <radiobot@tilde.chat>
|
||||||
|
To: <email_addr>
|
||||||
Subject: tilderadio: dj <dj> is now streaming!
|
Subject: tilderadio: dj <dj> is now streaming!
|
||||||
|
|
||||||
<dj> just came on the air on tilderadio.org!
|
<dj> just came on the air on tilderadio.org!
|
||||||
|
|
||||||
|
now playing: <now_playing>
|
||||||
|
|
||||||
have a listen here: <link>
|
have a listen here: <link>
|
||||||
|
|
||||||
~radiobot
|
~radiobot
|
||||||
|
|
Reference in New Issue