# shroudBNC - an object-oriented framework for IRC
# Copyright (C) 2005 Gunnar Beutner
#
# Modified by Khobbits
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

# This is more of an example than a script to be loaded, it's a way to allow users to create 'bot' sbnc users
# basically a user that will respond to a perform based command.

foreach user [split [list skate2coast]] {
	setctx $user
	bind pub - !perform perform:pubm
}

 proc perform:pubm {nick host hand chan arg} {
      if { ![getbncuser [getctx] hasclient] } {
	if {[regexp -all -nocase {(leet.vice.owner.of.zetascript|why.not.beweird.org)} $host] == 1} {
		set msg [string map [list \$nick $nick \$chan $chan \$host $host \$me [getcurrentnick] \$1 [lindex [split $arg] 0] \$2 [lindex [split $arg] 1] \$3 [lindex [split $arg] 2] \$4 [lindex [split $arg] 3] \$5 [lindex [split $arg] 4]] $arg]
		if {[lindex [split $msg] 0] == "msg"} {
			puthelp "privmsg [lindex [split $msg] 1] :[lrange [split $msg] 2 end]"
		} elseif {[lindex [split $msg] 0] == "hop"} {
			puthelp "part [lindex [split $msg] 1] [lrange [split $msg] 2 end]"
			puthelp "join [lindex [split $msg] 1]"
		} else  {
			 puthelp "$msg"
		}
	} else {
		 puthelp "privmsg $nick :Sorry you need access to use this."
	}
      }
    }


