pull notify_channels into a config var and grab slogans

This commit is contained in:
Ben Harris 2019-05-17 11:01:54 -04:00
parent 21591ad8db
commit 0a3b06ab0f
2 changed files with 23 additions and 22 deletions

View File

@ -2,5 +2,7 @@ server="localhost"
port="6667"
npfile="now_playing.txt"
channel="tilderadio"
notify_channels="meta team yourtilde $channel"
link="https://bhh.sh/listen"
nick="radiobot"
log="log.txt"

43
bot.sh
View File

@ -30,21 +30,17 @@ do
if [[ $dj != $(parse_dj) ]]; then
dj=$(parse_dj)
if [[ ! -z "${dj}" ]]; then
echo "PRIVMSG #$channel :$dj is now online! tune in now here: https://bhh.sh/listen" >> $input
echo "PRIVMSG #meta :$dj is now online! tune in now here: https://bhh.sh/listen" >> $input
echo "PRIVMSG #music :$dj is now online! tune in now here: https://bhh.sh/listen" >> $input
echo "PRIVMSG #yourtilde :$dj is now online! tune in now here: https://bhh.sh/listen" >> $input
for chan in $notify_channels; do
echo "PRIVMSG #$chan :$dj is now online! tune in now here: $link" >> $input
done
while read -u 10 subscriber; do
echo "PRIVMSG $subscriber :$dj is now online! tune in now here: https://bhh.sh/listen" >> $input
echo "PRIVMSG $subscriber :$dj is now online! tune in now here: $link" >> $input
done 10< subscribers.txt
# @tilderadio@tilde.zone
TOOT_JSON_PATH=. toot "dj $dj is now streaming live on https://tilderadio.org! tune in here: https://bhh.sh/listen"
# @yourtilde@tilde.zone
TOOT_JSON_PATH=./yourtilde toot "dj $dj is now streaming live on https://tilderadio.org! tune in here: https://bhh.sh/listen"
# @tildeteam@tilde.zone
toot "dj $dj is now streaming live on https://tilderadio.org! tune in here: https://bhh.sh/listen"
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
fi
fi
@ -63,10 +59,9 @@ do
# make sure we're joined
*376*|*404*)
echo "JOIN #$channel" >> $input
echo "JOIN #meta" >> $input
echo "JOIN #music" >> $input
echo "JOIN #yourtilde" >> $input
for chan in $notify_channels; do
echo "JOIN #$chan" >> $input
done
;;
# run when a message is seen
@ -89,8 +84,12 @@ do
case "$com" in
subscribe)
echo $who >> subscribers.txt
echo "PRIVMSG $from :i'll send you a direct message when a dj starts streaming!" >> $input
if grep -q $who subscribers.txt; then
echo "PRIVMSG $from :you're already subscribed! :)" >> $input
else
echo $who >> subscribers.txt
echo "PRIVMSG $from :i'll send you a direct message when a dj starts streaming!" >> $input
fi
;;
unsubscribe)
@ -111,15 +110,15 @@ do
;;
link)
echo "PRIVMSG $from :https://bhh.sh/listen" >> $input
echo "PRIVMSG $from :$link" >> $input
;;
help)
echo "PRIVMSG $from :hey hi, my commands are subscribe, unsubscribe, np, and dj" >> $input
echo "PRIVMSG $from :hey hi, my commands are subscribe, unsubscribe, np, dj, link, radio" >> $input
;;
radio)
echo "PRIVMSG $from :eat the poop or die!!1" >> $input
radio|slogan)
echo "PRIVMSG $from :$(curl -s https://ben.ttm.sh/slogans.txt | shuf -n1)" >> $input
;;
paymybills)