From 962537e98f4daae02289ee66eda09583f8eecb28 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 14 May 2012 14:45:08 -0500 Subject: [PATCH] add example bot --- newmont/handler | 37 +++++++++++++++++++++++++++++++++++++ newmont/nickname | 1 + newmont/server | 1 + 3 files changed, 39 insertions(+) create mode 100755 newmont/handler create mode 100644 newmont/nickname create mode 100644 newmont/server diff --git a/newmont/handler b/newmont/handler new file mode 100755 index 0000000..2c90988 --- /dev/null +++ b/newmont/handler @@ -0,0 +1,37 @@ +#! /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 diff --git a/newmont/nickname b/newmont/nickname new file mode 100644 index 0000000..b16bede --- /dev/null +++ b/newmont/nickname @@ -0,0 +1 @@ +newmont diff --git a/newmont/server b/newmont/server new file mode 100644 index 0000000..c2c6e47 --- /dev/null +++ b/newmont/server @@ -0,0 +1 @@ +moo.slashnet.org:6667