irc-bot/cobalt-handler

35 lines
683 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
text=$(cat)
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" || \
./whuffie woozle.whuffie.cdb "$text" || \
./infobot woozle.factoids.cdb "$text"
;;
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