ok here's a thing

This commit is contained in:
Ben Harris 2018-10-30 17:36:00 -04:00
parent c51c5e02b6
commit d7cf3771c6
Signed by untrusted user: ben
GPG Key ID: 4E0AF802FFF7960C
1 changed files with 11 additions and 0 deletions

11
bot.sh
View File

@ -5,6 +5,7 @@ input=".bot.cfg"
echo "Starting session: $(date "+[%y:%m:%d %T]")">$log
echo "NICK $nick" > $input
echo "USER $user" >> $input
echo "MODE $nick +B" >> $input
echo "JOIN #$channel" >> $input
@ -61,6 +62,8 @@ do
echo "$res"
who=$(echo "$res" | perl -pe "s/:(.*)\!.*@.*/\1/")
from=$(echo "$res" | perl -pe "s/.*PRIVMSG (.*[#]?([a-zA-Z]|\-)*) :.*/\1/")
echo $who $from
# "#" would mean it's a channel
if [ "$(echo "$from" | grep '^#')" ]; then
test "$(echo "$res" | grep ":$nick:")" || continue
@ -88,6 +91,14 @@ do
echo "PRIVMSG $from :${dj:-"no one"} is on the air now" >> $input
;;
help)
echo "PRIVMSG $from :hey hi, my commands are subscribe, unsubscribe, np, and dj"
;;
*)
echo "no command: $res"
;;
esac
;;