irc-bot/newmont/handler

38 lines
747 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! /bin/sh
prefix=$1; export prefix; shift
command=$1; export command; shift
sender=$1; export sender; shift
forum=$1; export forum; shift
text=$1; export text; shift
# $* is now args
# Debug output
echo '>>>' ${prefix:+:}$prefix $command "$@" ${text:+:}"$text" 1>&2
newmont () {
case $text in
*strawberry*)
echo "mmmmm"
;;
esac
}
case $command in
001)
printf "\007JOIN %s\n" "#dumont"
;;
PRIVMSG)
[ $forum = "#dumont" ] && newmont
;;
esac | while read -r line; do
case "$line" in
*)
printf "%s\r\n" "${line#}"
;;
*)
printf "PRIVMSG %s :%s\r\n" "$forum" "$line"
;;
esac
done