irc-bot/cobalt-handler

39 lines
814 B
Plaintext
Raw Normal View History

2010-12-15 22:36:16 -07:00
#! /bin/sh
sender=$1; export sender; shift
forum=$1; export forum; shift
prefix=$1; export prefix; shift
command=$1; export command; shift
# $* is now args
# Remeber, read discards leading whitespace. If that's not okay, use
# text=$(cat)
read -r text
2010-12-15 22:36:16 -07:00
join () {
printf '\aJOIN %s\n' "$1"
}
2010-12-15 22:36:16 -07:00
case $command in
001)
join "#woozle"
join "#foozle"
join "#bot"
2010-12-15 22:36:16 -07:00
;;
PRIVMSG)
2010-12-16 21:13:34 -07:00
case "$forum" in
\#*)
2010-12-16 21:13:34 -07:00
./firebot "$text" || \
2010-12-16 22:02:43 -07:00
./whuffie woozle/whuffie.cdb "$text" || \
./infobot woozle/factoids.cdb "$text"
2010-12-16 22:03:50 -07:00
./notes woozle/notes "$text"
2010-12-16 21:13:34 -07:00
;;
esac
2010-12-15 22:36:16 -07:00
;;
INVITE)
join "$forum"
echo "Thanks for the invitation, $sender."
2010-12-15 22:36:16 -07:00
;;
esac