mirror of https://github.com/nealey/irc-bot
39 lines
814 B
Bash
Executable File
39 lines
814 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
|
|
|
|
# Remeber, read discards leading whitespace. If that's not okay, use
|
|
# text=$(cat)
|
|
read -r text
|
|
|
|
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
|
|
|