irc-bot/cobalt-handler

36 lines
728 B
Bash
Executable File

#! /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"
}
case $command in
001)
join "#woozle"
join "#foozle"
join "#bot"
;;
PRIVMSG)
case "$forum" in
\#*)
./firebot "$text" || \
./whuffie woozle/whuffie.cdb "$text" || \
./infobot woozle/factoids.cdb "$text"
./notes woozle/notes "$text"
;;
esac
;;
INVITE)
join "$forum"
echo "Thanks for the invitation, $sender."
;;
esac