diff --git a/bot.properties b/bot.properties index 15821d2..5eb393f 100644 --- a/bot.properties +++ b/bot.properties @@ -4,5 +4,6 @@ npfile="now_playing.txt" channel="tilderadio" notify_channels="meta team yourtilde $channel" link="https://ttm.sh/listen" +schedule="https://tilderadio.org/schedule/" nick="radiobot" log="log.txt" diff --git a/bot.sh b/bot.sh index 30f0835..98d37d4 100644 --- a/bot.sh +++ b/bot.sh @@ -16,6 +16,10 @@ function parse_dj { grep -Eo '^\([^)]*\)' $npfile | sed 's/[()]//g' | xargs } +function msg { + echo "PRIVMSG ${1} :${2}" >> $input +} + # save info save_info dj=$(parse_dj) @@ -31,11 +35,11 @@ do dj=$(parse_dj) if [[ ! -z "${dj}" ]]; then for chan in $notify_channels; do - echo "PRIVMSG #$chan :$dj is now online! tune in now here: $link" >> $input + msg "#$chan" "$dj is now online! tune in now here: $link" done while read -u 10 subscriber; do - echo "PRIVMSG $subscriber :$dj is now online! tune in now here: $link" >> $input + msg $subscriber "$dj is now online! tune in now here: $link" done 10< subscribers.txt for json in . ./yourtilde ./team; do @@ -85,44 +89,48 @@ do case "$com" in subscribe) if grep -q $who subscribers.txt; then - echo "PRIVMSG $from :you're already subscribed! :)" >> $input + msg $from "you're already subscribed! :)" else echo $who >> subscribers.txt - echo "PRIVMSG $from :i'll send you a direct message when a dj starts streaming!" >> $input + msg $from "i'll send you a direct message when a dj starts streaming!" fi ;; unsubscribe) sed -i "/$who/d" subscribers.txt - echo "PRIVMSG $from :i'll stop sending you updates." >> $input + msg $from "i'll stop sending you updates." ;; time) - echo "PRIVMSG $from :$(TZ=UTC date)" >> $input + msg $from "$(TZ=UTC date)" ;; np) - echo "PRIVMSG $from :$now_playing" >> $input + msg $from "$now_playing" ;; dj) - echo "PRIVMSG $from :${dj:-"no one"} is on the air now" >> $input + msg $from "${dj:-"no one"} is on the air now" ;; link) - echo "PRIVMSG $from :$link" >> $input + msg $from "$link" + ;; + + schedule) + msg $from "$schedule" ;; help) - echo "PRIVMSG $from :hey hi, my commands are subscribe, unsubscribe, np, dj, link, radio" >> $input + msg $from "hey hi, my commands are subscribe, unsubscribe, np, dj, link, slogan, and schedule" ;; radio|slogan) - echo "PRIVMSG $from :$(curl -s https://ben.ttm.sh/slogans.txt | shuf -n1)" >> $input + msg $from "$(curl -s https://ben.ttm.sh/slogans.txt | shuf -n1)" ;; paymybills) - echo "PRIVMSG $from :whaddya mean?! i'm broker than you!" >> $input + msg $from "whaddya mean?! i'm broker than you!" ;; *) @@ -138,3 +146,4 @@ do ;; esac done +