email notifs
This commit is contained in:
parent
2a1b1f8a2c
commit
c45157dfd1
22
bot.sh
22
bot.sh
|
@ -42,6 +42,11 @@ do
|
|||
msg $subscriber "$dj is now online! tune in now here: $link"
|
||||
done 10< subscribers.txt
|
||||
|
||||
while read -u 11 subscriber email_addr; do
|
||||
sed -e "s/<dj>/$dj/g" -e "s/<link>/$link/g" dj-online-email.tmpl \
|
||||
| sendmail email_addr
|
||||
done 11< email-subscribers.txt
|
||||
|
||||
for json in . ./yourtilde ./team; do
|
||||
TOOT_JSON_PATH=$json toot "dj $dj is now streaming live on https://tilderadio.org! tune in here: $link"
|
||||
done
|
||||
|
@ -101,6 +106,21 @@ do
|
|||
msg $from "i'll stop sending you updates."
|
||||
;;
|
||||
|
||||
email-subscribe)
|
||||
if grep -q $who email-subscribers.txt; then
|
||||
msg $from "you're already subscribed! :)"
|
||||
else
|
||||
email_addr=$(echo "$will" | cut -d " " -f2)
|
||||
echo "$who $email_addr" >> email-subscribers.txt
|
||||
msg $from "i'll send you an email when a dj starts streaming!"
|
||||
fi
|
||||
;;
|
||||
|
||||
email-unsubscribe)
|
||||
sed -i "/$who/d" email-subscribers.txt
|
||||
msg $from "i'll stop sending you email updates."
|
||||
;;
|
||||
|
||||
time)
|
||||
msg $from "$(TZ=UTC date)"
|
||||
;;
|
||||
|
@ -126,7 +146,7 @@ do
|
|||
;;
|
||||
|
||||
help)
|
||||
msg $from "hey hi, my commands are subscribe, unsubscribe, np, dj, link, slogan, and schedule"
|
||||
msg $from "hey hi, my commands are subscribe, unsubscribe, np, dj, link, slogan, and schedule. if you prefer email notifications, you can use radiobot: email-subscribe you@example.com"
|
||||
;;
|
||||
|
||||
radio|slogan)
|
||||
|
|
8
dj-online-email.tmpl
Normal file
8
dj-online-email.tmpl
Normal file
|
@ -0,0 +1,8 @@
|
|||
Subject: tilderadio: dj <dj> is now streaming!
|
||||
|
||||
<dj> just came on the air on tilderadio.org!
|
||||
|
||||
have a listen here: <link>
|
||||
|
||||
~radiobot
|
||||
|
Reference in New Issue
Block a user