This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

EggServ missing close-bracket

Help for those learning Tcl or writing their own scripts.
Post Reply
d
desperado836
Voice
Posts: 2
Joined: Thu Nov 15, 2012 11:42 am

EggServ missing close-bracket

Post by desperado836 »

I am using EggServ v0.8.1 on my eggdrop v1.6.21. I get a error when trying out the !ban feature, I get a Tcl error [pub_eggserv_ban]: missing close-bracket. As far as I can tell, it seems everything else works fine except bans/kickbans.
I have just this script running and got the .set errorInfo:
[23:48] <ScouseBot> Currently: missing close-bracket
[23:48] <ScouseBot> Currently: while compiling
[23:48] <ScouseBot> Currently: "puthelp "NOTICE $nick :\002Usage:\002 [string trim $!ban <nick|mask> \[time\] \[reason\]"
[23:48] <ScouseBot> Currently: return 0
[23:48] <ScouseBot> Currently: "
[23:48] <ScouseBot> Currently: ("if" then script line 2)
[23:48] <ScouseBot> Currently: while compiling
[23:48] <ScouseBot> Currently: "if {[llength $arg] < 1} {
[23:48] <ScouseBot> Currently: puthelp "NOTICE $nick :\002Usage:\002 [string trim $!ban <nick|mask> \[time\] \[reason\]"
[23:48] <ScouseBot> Currently: return 0
[23:48] <ScouseBot> Currently: }"
[23:48] <ScouseBot> Currently: ("if" then script line 2)
[23:48] <ScouseBot> Currently: while compiling
[23:48] <ScouseBot> Currently: "if {[matchattr $opper |+n] || [matchattr $opper |+m] || [matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [matchattr $opper |+o $chan]..."
[23:48] <ScouseBot> Currently: (compiling body of proc "pub_eggserv_ban", line 5)
[23:48] <ScouseBot> Currently: invoked from within
[23:48] <ScouseBot> Currently: "pub_eggserv_ban $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"

Code: Select all

################################################### 
###################################################
###      _____            _____                 ###
###     / ___/__ __ __ __/  __/___ __ ___ __    ###
###    /  _// . ` / . ` /\__ \  ._\  `_/ ` /    ###
###   /____/\__  /\__  /_____/\__/|__| \__/     ###
###        /____//____/          .Tcl v0.8.1    ###
###                                             ###
################################################### 
###################################################
###            EggServ.tcl by Lupo              ###
###       Come and visit us on #EggServ         ###
###             On irc.ircbox.com!              ###
###################################################
###################################################
##  Portions based on SuperScript.tcl, lol.tcl   ##
##         and opcmds.tcl by xTc^bLiTz           ##
###################################################
###################################################
## Thanks and hello to :                         ##
## Thommey and Rudenstam from #egghelp@freenode  ##
## The nice people from #tcl@freenode            ##
## BoNe, Sir_Fz, dwr, DarkIntentions             ##
###################################################
###################################################

##
## This script offers a range of public commands to the channel
##
##
## Version History
## v0.8.1 Bug fixes based on feedback from initial release (check VERSION_HISTORY for overview on fixed bugs)
## v0.8.0 Ban system cleanups
## v0.7.9 added !topic command
## v0.7.8 Synchronisation for channelmodes between eggdrop and services, added NOPstatus
## v0.7.7 code cleanup, nick to hand optimalisations
## v0.7.6 Implemented a quite nifty assign routine :o)
## v0.7.5 Added User Registration and msg commands
## v0.7.4 Added assign/unassign commands
## v0.7.3 Added verbose messages, protectops and retaliation
## v0.7.2 Bugfixes
## v0.7.1 Changes to private messages, help menu
## v0.7.0 Original version (split off from chancommands.tcl)

##
## Settings
##
# Channel settings
## Set the channels the script should be active on ("" for all channels)
#
## Set Services Version
## Set your services flavor here 
## Supported Services
## No Services - "none"
## Anope 1.x - "anope"
## Atheme 2.x - "atheme"
set services "anope"

## Set chanserv
## Set your ChanServ nickname here 
set chanserv "ScouseBot"

##
## Set ServiceChannel
## This is EggServs Default Channel
set servicechan ""

## ProtectOps
## Prevents ops from being kicked and banned
## Set to 0 to disable
set protectops 1

## Retaliation
## Take revenge on opkick and opban
## Set to 1 to Enable
set retaliation 0

## Set Verbose Messages
## Makes EggServ more chatty (debug)
## Set to 1 to enable
set verbosemsgs 0

## Set Debug Messages
## Makes EggServ Even more chatty (debug)
## Set to 1 to enable
set debugmsgs 0

## Have Management tools installed?
set mgmttools 1

#ban type
#  0 - *!*user@*.domain
#  1 - *!*@host.domain
set eggserv_bantype 1

############################
# Advanced Settings
############################

# Disable Ident function
set eggserv_ident 1

# Disable clones function
set eggserv_clones 1

#
##
### Public binds - Change to your liking ###
bind pub -|- !register pub_eggserv_register
bind pub -|- !drop pub_eggserv_drop
bind pub -|- !assign pub_eggserv_assign
bind pub -|- !unassign pub_eggserv_unassign
bind pub -|- !topic pub_eggserv_topic
bind pub -|- !k pub_eggserv_kick
bind pub -|- !kick pub_eggserv_kick
bind pub -|- !b pub_eggserv_ban
bind pub -|- !ban pub_eggserv_ban
bind pub -|- !kb pub_eggserv_ban
bind pub -|- !kickban pub_eggserv_ban
bind pub -|- !banlist pub_eggserv_banlist
bind pub -|- !ub pub_eggserv_unban
bind pub -|- !unban pub_eggserv_unban
bind pub -|- !v pub_eggserv_voice
bind pub -|- !dv pub_eggserv_devoice
bind pub -|- !voice pub_eggserv_voice
bind pub -|- !devoice pub_eggserv_devoice
bind pub -|- !h pub_eggserv_halfop
bind pub -|- !dh pub_eggserv_dehalfop
bind pub -|- !hop pub_eggserv_halfop
bind pub -|- !dehop pub_eggserv_dehalfop
bind pub -|- !halfop pub_eggserv_halfop
bind pub -|- !dehalfop pub_eggserv_dehalfop
bind pub -|- !o pub_eggserv_op
bind pub -|- !do pub_eggserv_deop
bind pub -|- !op pub_eggserv_op
bind pub -|- !deop pub_eggserv_deop
bind pub -|- !p pub_eggserv_protect
bind pub -|- !dp pub_eggserv_deprotect
bind pub -|- !protect pub_eggserv_protect
bind pub -|- !deprotect pub_eggserv_deprotect
bind pub -|- !q pub_eggserv_owner
bind pub -|- !dq pub_eggserv_deowner
bind pub -|- !owner pub_eggserv_owner
bind pub -|- !deowner pub_eggserv_deowner
bind pub -|- !addvoice pub_eggserv_addvop
bind pub -|- !delvoice pub_eggserv_delvop
bind pub -|- !addnop pub_eggserv_addnop
bind pub -|- !delnop pub_eggserv_delnop
bind pub -|- !addvop pub_eggserv_addvop
bind pub -|- !delvop pub_eggserv_delvop
bind pub -|- !addhop pub_eggserv_addhop
bind pub -|- !delhop pub_eggserv_delhop
bind pub -|- !addhalfop pub_eggserv_addhop
bind pub -|- !delhalfop pub_eggserv_delhop
bind pub -|- !addaop pub_eggserv_addaop
bind pub -|- !delaop pub_eggserv_delaop
bind pub -|- !addfullop pub_eggserv_addaop
bind pub -|- !delfullop pub_eggserv_delaop
bind pub -|- !addsop pub_eggserv_addsop
bind pub -|- !delsop pub_eggserv_delsop
bind pub -|- !addadmin pub_eggserv_addsop
bind pub -|- !deladmin pub_eggserv_delsop
bind pub -|- !addprotect pub_eggserv_addsop
bind pub -|- !delprotect pub_eggserv_delsop
bind pub -|- !help pub_eggserv_help
#############################################
##
#

##                                                                                       ##
############################## Configuration Ends Here ####################################
##                                                                                       ##


########################### Some basic functions used later ###############################
proc low {i} {return [string tolower $i]}
proc stringtopattern {string} {return [string map [list \\ \\\\ \[ \\\[ \] \\\] ] $string]}
###########################################################################################

set eggservvers "0.8.1"


###########################################################################################
## Channel Assign / Unassign
###########################################################################################

#
##
###Assigning Channel
proc pub_eggserv_assign {nick host handle chan text} {
global botnick verbosemsgs
  	if {[set channel [string trim [lindex [split $text] 0]]] == "" || [string index $channel 0] != "#"} {
  	      putserv "PRIVMSG $chan :Syntax: $::lastbind <#channel>"
  	      return 0
  	}
  	if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :$nick is assigning $botnick to $channel."}
	if {[validchan $channel]} {
		putserv "NOTICE $nick :$botnick is already assigned to $channel."
		return 1
	}
	channel add $channel
  	set ::request_from_chan($channel) $chan
  	set ::request_from_nick($channel) $nick
	if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :$botnick joined $channel for modechecking."}
}
###
##
#

bind raw - 315 do_assign_finalisation

proc do_assign_finalisation {from key text} {
	   global botnick verbosemsgs servicechan
  	   set channel [lindex [split $text] 1]
  	   if {![info exists ::request_from_chan($channel)]} {
  	      return 0
  	   }   
if { [isop $::request_from_nick($channel) $channel] == 1 || \
	 [isadmin $::request_from_nick($channel) $channel] == 1 || \
	 [isowner $::request_from_nick($channel) $channel] == 1 } {				
		set owner [nick2hand $::request_from_nick($channel) $channel]
		putserv "NOTICE $owner :$botnick has been assigned to $channel."
		chattr $owner |+mnoflv $channel
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $servicechan :$botnick has been successfully assigned to $channel"}
		return 1
		} else {
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $servicechan :Modecheck for $::request_from_nick($channel) by $botnick has failed for $channel"}
		putserv "NOTICE $::request_from_nick($channel) : You need to be an operator or higher in order to assign $botnick to $channel."
		channel remove $where	
		return 1
		}
}	


#
##
###part channel
proc pub_eggserv_unassign {nick host handle chan text} {
	global botnick servicechan verbosemsgs debugmsgs
	set owner [nick2hand $nick $chan]
	if { $chan == $servicechan } {
		channel remove $chan
		putserv "NOTICE $nick :You cannot unassign $botnick's default channel."
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $servicechan :$chan has been unassigned from $botnick by $owner"}
	}	
	if {[matchattr $owner +n $chan] || [matchattr $owner +n] } {
		channel remove $chan
		putserv "NOTICE $nick :$chan has been unassigned from $botnick"
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $servicechan :$chan has been unassigned from $botnick by $owner"}
	}
}
###
##
#

###########################################################################################
## User Registration options
###########################################################################################

#
##
###Add a user to the bot
proc pub_eggserv_register {nick host handle chan text} {
global botnick
set who [lindex $text 0]
set thost [getchanhost $who $chan]
set mhost [maskhost [getchanhost $who $chan]]
	if {$who == ""} {
		adduser $nick $mhost
		putserv "NOTICE $nick :You have been registered to $botnick."
		set thandle [nick2hand $nick $chan]
		chattr $thandle +h
		return 1
	}
	if {![onchan $who $chan]} {
		putserv "NOTICE $nick :$who needs to be online and on $chan."
		return 1
	} 
	adduser $who $mhost
	putserv "PRIVMSG $nick :User $who has been registered in $botnick."
	set thandle [nick2hand $who $chan]
	chattr $thandle +h
	#addhost $thandle $mhost
	return 1
}
###
##
#

#
##
###Delete an user from the records.
proc pub_eggserv_drop {nick host handle chan text} {
global botnick verbosemsgs
set who [lindex $text 0]
	if {[matchattr $who +n]} {
		return 1
	}
	if {$who == ""} {
	set thandle [nick2hand $nick $chan]
		
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Deleting $nick ($thandle) from $botnick."}
		deluser $nick
		putserv "NOTICE $nick :Your registration has been dropped from $botnick."
		return 1
		
	}
	
	if {![onchan $who $chan]} {
		putserv "NOTICE $nick :The user needs to be online to be removed from $botnick."
		return 1
	} 
	set thandle [nick2hand $who $chan]
	
	if {$thandle == "*"} {
		putserv "NOTICE $nick :$who isn't in the $botnick user database."
		return 1
	}
	if {[matchattr $who +n] } {
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Deleting $nick ($thandle) from $botnick."}
		deluser $thandle
		putserv "NOTICE $nick :User $who has been removed from $botnick."
		return 1
	}
}
###
##
#

###########################################################################################
## Services Integration
###########################################################################################

#
##
###
proc pub_eggserv_addnop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan]} {
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		adduser $who $mhost
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done adding $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		if {$who == ""} {
			putserv "NOTICE $nick :Usage: !addnop <Nick to add>"
			return 1
		}
		chattr $whohandle +f|+dr $chan
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :$who added to $chan NOP list."}
		putserv "NOTICE $nick :$who added to $chan NOP list."		
	}
}
###
##
#

#
##
###
proc pub_eggserv_delnop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] } {
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done removing $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|-v $chan
		if {$who == ""} {
			putserv "NOTICE $nick :Usage: !delvop <Nick to add>"
			return 1
		}
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :$who added to $chan NOP list."}
		putserv "NOTICE $nick :$who added to $chan NOP list."
	}
}
###
##
#


#
##
###
proc pub_eggserv_addvop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan]} {
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		adduser $who $mhost
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done adding $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|+fv $chan
		if {$who == ""} {
			putserv "NOTICE $nick :Usage: !addvop <Nick to add>"
			return 1
		}
		if { ($services == "anope") } {
			return [do_addservicesuser $nick $who $chan VOP]	   
		}
		if { ($services == "atheme") } {
			return [do_addservicesuser $nick $who $chan +V]	   
		}
		if { ($services == "none") } {
			return 1
		}
	}
}
###
##
#

#
##
###
proc pub_eggserv_delvop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] } {
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done removing $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|-v $chan
		if {$who == ""} {
			putserv "NOTICE $nick :Usage: !delvop <Nick to add>"
			return 1
		}
		if { ($services == "anope") } {
			return [do_delservicesuser $nick $who $chan VOP]	   
		}
		if { ($services == "atheme") } {
			return [do_addservicesuser $nick $who $chan -V]	   
		}
		if { ($services == "none") } {
			return 1
		}
	}
}
###
##
#


#
##
###
proc pub_eggserv_addhop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [matchattr $opper |+o $chan]} {		
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		adduser $who $mhost
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done adding $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|+flv $chan
		if {$who == ""} {
			putserv "NOTICE $nick :Usage: !addhop <Nick to add>"
			return 1
		}
		if { ($services == "anope") } {
			return [do_addservicesuser $nick $who $chan HOP]	   
		}
		if { ($services == "atheme") } {
			return [do_addservicesuser $nick $who $chan +H]	   
		}
		if { ($services == "none") } {
			return 1
		}
	}
}
###
##
#

#
##
###
proc pub_eggserv_delhop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [matchattr $opper |+o $chan]} {	
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done removing $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|-lv $chan
		if { ($services == "anope") } {
			return [do_delservicesuser $nick $who $chan HOP]	   
		}
		if { ($services == "atheme") } {
			return [do_addservicesuser $nick $who $chan -H]	   
		}   
		if { ($services == "none") } {
			return 1
		}
	}
}
###
##
#


#
##
###
proc pub_eggserv_addaop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan]} {	
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		adduser $who $mhost
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done adding $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|+faolv $chan
		if {$who == ""} {
			putserv "NOTICE $nick :Usage: !addaop <Nick to add>"
			return 1
		}
		if { ($services == "anope") } {
			return [do_addservicesuser $nick $who $chan AOP]	   
		}
		if { ($services == "atheme") } {
			return [do_addservicesuser $nick $who $chan +Oh]	   
		} 
		if { ($services == "none") } {
			return 1
		}
	}
}
###
##
#

#
##
###
proc pub_eggserv_delaop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan]} {	
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done removing $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|-aolv $chan

		if { ($services == "anope") } {
			return [do_delservicesuser $nick $who $chan AOP]	   
		}
		if { ($services == "atheme") } {
			return [do_addservicesuser $nick $who $chan -Oh]	   
		}    
		if { ($services == "none") } {
			return 1
		}
	}
}
###
##
#


#
##
###
proc pub_eggserv_addsop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] } {	
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		adduser $who $mhost
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done adding $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|+famolv $chan
		if {$who == ""} {
			putserv "NOTICE $nick :Usage: !addvop <Nick to add>"
			return 1
		}
		if { ($services == "anope") } {
			return [do_addservicesuser $nick $who $chan SOP]	   
		}
		if { ($services == "atheme") } {
			return [do_addservicesuser $nick $who $chan +a]	   
		} 
		if { ($services == "none") } {
			return 1
		}
	}
}
###
##
#

#
##
###
proc pub_eggserv_delsop {nick host handle chan text} {
	global services botnick verbosemsgs
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] } {
		set who [lindex $text 0]
		if {$who == $botnick} {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to modify modes on myself."}
		    return 0
  	  	}
		set whohost [getchanhost $who $chan]
		set mhost [maskhost [getchanhost $who $chan]]
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Done removing $who in the $botnick user database for channel $chan."}
		set whohandle [nick2hand $who $chan]
		chattr $whohandle +f|-amolv $chan

		if { ($services == "anope") } {
			return [do_delservicesuser $nick $who $chan SOP]	   
		}
		if { ($services == "atheme") } {
			return [do_addservicesuser $nick $who $chan -a]	   
		}    
		if { ($services == "none") } {
			return 1
		}
	}
}
###
##
#


#
##
###
proc do_addservicesuser {nick who chan mode} {	
	global services chanserv workingchans
		if { ($services == "anope") } {
			putserv "PRIVMSG $chanserv :$mode $chan ADD $who"
		}
		if { ($services == "atheme") } {
			putserv "PRIVMSG $chanserv :FLAGS $chan $who $mode"
		}
		if { ($services == "none") } {
			return 1
		}
		putserv "NOTICE $nick :$who added to $chan $mode list."		   
 	   	return 1
}
###
##
#

#
##
###
proc do_delservicesuser {nick who chan mode} {	
	global services chanserv workingchans
		if { ($services == "anope") } {
		putserv "PRIVMSG $chanserv :$mode $chan DEL $who"
		}
		if { ($services == "atheme") } {
			putserv "PRIVMSG $chanserv :FLAGS $chan $who $mode"
		}
		if { ($services == "none") } {
			return 1
		}
		putserv "NOTICE $nick :$who removed from $chan $mode list."		   
 	   	return 1
}
###
##
#


###########################################################################################
## Channel Kick/Ban
###########################################################################################

#
##
###Kick
proc pub_eggserv_kick {nick host handle chan text} {
	global botnick workingchans
	global protectops retaliation
	proc gethandle {nick} {
		set host [getchanhost $nick]
		set handle [finduser "*!$host"]
		return $handle
}
set who [lindex $text 0]
set why [lrange $text 1 end]	
# leave when bot dont has op
set opper [nick2hand $nick $chan]
if {![botisop $chan]} {return 0}
		if {$protectops == 1 } {	
			if {[isop $who $chan] == 1} {
				if {$retaliation == 1 } {putserv "KICK $chan $nick :Kicking an operator is not allowed"}
				return 1
			}
		}
		if {[string tolower $who] == [string tolower $botnick]} {
			if {$retaliation == 1 } {putserv "KICK $chan $nick :Attempted channel takeover"}
			return 1 
		}
		if {[string tolower $who] == [string tolower $nick]} {
			putserv "KICK $chan $nick :Requested Self-kick"
		return 1
		}
		if {[matchattr $opper |+n] || [matchattr $opper |+m] || \
			[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
			[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
			[ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || \
			[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1 } {
				putserv "KICK $chan $who :$why"
	 	} else {
			putserv "NOTICE $nick :You do not have the correct privileges to use this command."
		}
		return 1
}
###
##
#

proc pub_eggserv_ban {nick host hand chan arg} {
	global botnick eggserv_bantype
	set arg [charfilter $arg]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n] || [matchattr $opper |+m] || \
		[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
		[ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || \
		[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1 } {
		if {[llength $arg] < 1} {
			puthelp "NOTICE $nick :\002Usage:\002 [string trim $!ban <nick|mask> \[time\] \[reason\]"
			return 0
		}
		set who [lindex $arg 0]
		if {[strlwr $who] == [strlwr $botnick]} {
			puthelp "NOTICE $nick :Yeah right, like I'm going to let you ban ME!"
			return 0
		}
	
		set ti [lindex $arg 1]

		if {[isnumber $ti]} {
			set reason [lrange $arg 2 end]
		} else {
			set ti ""
			set reason [lrange $arg 1 end]
		}

		if {$reason == ""} { set reason "requested" }
	
		if {[onchan $who $chan]} {
			if { $eggserv_bantype == 0 } { 
				set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
				set usermask [lindex [split [getchanhost $who $chan] "@"] 0]		
				set banmask *!*$usermask@$ipmask
			} else { 
				set banmask [getchanhost $who $chan]
     	      	set banmask "*!*[string range $banmask [string first @ $banmask] e]" 
			}	
		} else {  		
			set banmask [lindex $arg 0]
		if {[string first "!" $banmask] == -1 && [string first "@" $banmask] == -1} {
			if {[isnumber [string index $banmask 0]]} { 
				set banmask *!*@$banmask 
			} else {
				 set banmask $banmask*!*@* 
			}
		}
		if {[string first "!" $banmask] == -1} { set banmask *!*$banmask }
		if {[string first "@" $banmask] == -1} { set banmask $banmask*@* }
	}
			   		
	if {![botisop $chan]} { return 0 }
	putserv "MODE $chan +b $banmask"

  	foreach chanuser [chanlist $chan] {
      	if {[string match [strlwr $banmask] [strlwr "$chanuser![getchanhost $chanuser $chan]"]] && $chanuser != $botnick } { 
			if {[nick2hand $chanuser $chan] != "*"} {
				if {$hand != [nick2hand $chanuser $chan]} {
					if {[matchattr [nick2hand $chanuser $chan] o|o $chan] && ![matchattr $hand o|o $chan]} {
        	          	            puthelp "NOTICE $nick :Sorry, you must be an operator to ban an operator."
						return 0
					}
					if {([matchattr [nick2hand $chanuser $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan]} {
            		                  puthelp "NOTICE $nick :Sorry, you must be a master to ban a master or a bot."
						return 0
					}
				}
			}
	    	   	putkick $chan $chanuser $reason
		}
       }	 

	switch $ti {
		""
		{
			newchanban $chan $banmask $nick $reason
			puthelp "NOTICE $nick :New mask added : $banmask"
		}
		0
		{
			newchanban $chan $banmask $nick $reason $ti
			puthelp "NOTICE $nick :New mask added permanently : $banmask"
		}
		default
		{
			newchanban $chan $banmask $nick $reason $ti
			puthelp "NOTICE $nick :New mask added for $ti minutes : $banmask"
		}
	}
	return 0
	}	
	
}

#
##
### Ban
proc pub_eggserv_unban {nick host hand chan arg} {
	set arg [charfilter $arg]
	global botnick verbosemsgs debugmsgs servicechan
	if {[llength $arg] != 1} {
	        if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :We're in second if loop."}
		puthelp "NOTICE $nick :\002Usage:\002 !unban <mask|number>"
		return 0
	}
	set find 0
	set mask [lindex $arg 0]

	if {[isnumber $mask]} {
		foreach bans [banlist $chan] {
			incr find
			if {$find == $mask} { set mask [lindex $bans 0] ; break }
		        if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :We're in third if loop."}
		}
		if {[isnumber $mask]} {
			puthelp "NOTICE $nick :There is no ban number $mask in this chan, type !banlist."
			return 0
		} 
	} else {	
	if {[string first "!" $mask] == -1 && [string first "@" $mask] == -1} {
		if {[isnumber [string index $mask 0]]} { 
			set mask *!*@$mask 
		} else { 
			set mask $mask*!*@* 
		}
	}
			if {[string first "!" $mask] == -1} {set mask *!*$mask}
			if {[string first "@" $mask] == -1} {set mask $mask*@*}
	}
	
	if {[isban $mask $chan]} { 
		killchanban $chan $mask
		killban $mask
		puthelp "NOTICE $nick :Ban successfully removed on $chan."
		return 0
	} 

	foreach bans [chanbans $chan] {
		set victim [lindex $bans 0]
		if {[strlwr $victim] == [strlwr $mask]} {set find 1}
	}

	if {[botisop $chan] && $find == 1} {
		pushmode $chan -b $mask
            puthelp "NOTICE $nick :Ban successfully removed."
		return 0
	}
	puthelp "NOTICE $nick :No such ban on $chan."
	return 0
}
###
##
#

#
##
###Banlist
proc pub_eggserv_banlist {nick host handle chan text} {
	global botnick
	global protectops retaliation
	set opper [nick2hand $nick $chan]
		
		if {[matchattr $opper |+n] || [matchattr $opper |+m] || \
			[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
			[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
			[ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || \
			[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1 } {
				
			putserv "NOTICE $nick :Banlist for $chan in $botnick."
			set num 1
			foreach chanbans [ banlist $chan ] {
				set banneduser [lindex $chanbans 0]
				set why [lindex $chanbans 1]
				set expire [lindex $chanbans 2]
				set who [lindex $chanbans 5]
				set remain [expr $expire - [unixtime]]
				if {$remain > 0} {
					set remain "expire in [time_diff2 $expire]."
				} else {
					set remain "Permanent"
				}
				
			putserv "NOTICE $nick :\002BAN $num:\002 $banneduser, $remain"
			putserv "NOTICE $nick :$who: $why"
			incr num
			}		
			putserv "NOTICE $nick :End of banlist for $chan."
	 	} else {
			putserv "NOTICE $nick :You do not have the correct privileges to use this command."
		}
	return 1
}
###
##
#

###########################################################################################
## Set Modes
###########################################################################################

#
##
###
proc do_mode {nick chan mode} {	
	global workingchans botnick 
	global verbosemsgs servicechan
	# leave when bot dont has op
	if {![botisop $chan] && ![isowner $botnick $chan] && ![isadmin $botnick $chan]} {return 0}
#		if {$verbosemsgs == 1 } {putserv "PRIVMSG $servicechan :$botnick and $nick."}
	  	if { [string equal -nocase $botnick $nick] } {
			if {$verbosemsgs == 1 } {putserv "PRIVMSG $chan :Cowardly refusing to set modes on myself."}
		    return 1
  	  	}
		if {$verbosemsgs == 1 } {putserv "PRIVMSG $servicechan :Setting $mode to $nick on $chan..."}
		putserv "MODE $chan $mode $nick"
}
###
##
#

###########################################################################################
## Mode commands
###########################################################################################


#
##
###
proc pub_eggserv_voice {nick host handle chan text} {
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
		[matchattr $opper |+v $chan] || [ishalfop $nick $chan] == 1 || \
		[isop $nick $chan] == 1 || [isadmin $nick $chan] == 1 || \
		[isowner $nick $chan] == 1} {
		if {$who == ""} {set who $nick} 	
		if {[isvoice $who $chan]} {
			putserv "NOTICE $nick :$who already has a voice on $chan."
			return 1
		}
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		return [do_mode $who $chan +v]  
	}
}
###
##
#

#
##
###
proc pub_eggserv_devoice {nick host handle chan text} {
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
		[matchattr $opper |+v $chan] || [ishalfop $nick $chan] == 1 || \
		[isop $nick $chan] == 1 || [isadmin $nick $chan] == 1 || \
		[isowner $nick $chan] == 1 } {
		if {$who == ""} {set who $nick} 
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
#		if {![isvoice $who $chan]} {
#			putserv "NOTICE $nick :$who doesn't have a voice on $chan."
#			return 1
#		}
		return [do_mode $who $chan -v]            
	}
}
###
##
#

#
##
###
proc pub_eggserv_halfop {nick host handle chan text} {
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
		[ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || \
		[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {		
		if {$who == ""} {set who $nick} 	
		if {[ishalfop $who $chan]} {
			putserv "NOTICE $nick :$who already has a halfop on $chan."
			return 1
		}
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		return [do_mode $who $chan +h]  
	}
}
###
##
#

#
##
###
proc pub_eggserv_dehalfop {nick host handle chan text} {
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
		[ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || \
		[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
		if {$who == ""} {set who $nick} 
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		if {![ishalfop $who $chan]} {
			putserv "NOTICE $nick :$who doesn't have a halfop on $chan."
			return 1
		}
		return [do_mode $who $chan -h]            
	}
}
###
##
#

#
##
###
proc pub_eggserv_op {nick host handle chan text} {
	global verbosemsgs debugmsgs servicechan
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {$who == ""} {set who $nick} 
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Channelname : $chan."}		
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Opper : $opper."}
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Nickname : $who."}
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsOwner (bot) : [matchattr $opper |+n $chan]"}
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsAdmin (bot) : [matchattr $opper |+m $chan]"}
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Isop (bot) : [matchattr $opper |+o $chan]"}
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsOwner (services) : [isowner [strlwr $who] $chan]"}		
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsAdmin (services) : [isadmin [strlwr $who] $chan]"}	
	if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsOp (services) : [isop [strlwr $who] $chan]"}	
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [isop $nick $chan] == 1 || \
		[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {		

		if {[isop $who $chan]} {
			putserv "NOTICE $nick :$who already has an op on $chan."
			return 1
		}
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Opping $who on $chan"}	
		return [do_mode $who $chan +o]  
	}
}
###
##
#

#
##
###
proc pub_eggserv_deop {nick host handle chan text} {
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [isop $nick $chan] == 1 || \
		[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
		if {$who == ""} {set who $nick} 
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		if {![isop $who $chan]} {
			putserv "NOTICE $nick $who doesn't have an op on $chan."
			return 1
		}
		return [do_mode $who $chan -o]            
	}
}
###
##
#

#
##
###
proc pub_eggserv_protect {nick host handle chan text} {
	global verbosemsgs debugmsgs servicechan
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
		if {$who == ""} {set who $nick} 
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Channelname : $chan."}		
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Nickname : $who."}
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsAdmin : [isadmin [strlwr $who] $chan]"}
		if {$who == ""} {set who $nick} 
		if { [isadmin [strlwr $who] $chan] == 1 } {
			putserv "NOTICE $nick :$who already is protected on $chan."
			return 1
		}
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		return [do_mode $who $chan +a]  
	}
}
###
##
#

#
##
###
proc pub_eggserv_deprotect {nick host handle chan text} {
	global verbosemsgs debugmsgs servicechan
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
		if {$who == ""} {set who $nick} 
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Channelname : $chan."}		
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Nickname : $who."}
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsAdmin : [isadmin [strlwr $who] $chan]"}

		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		if {![isadmin [strlwr $who] $chan] == 1} {
			putserv "NOTICE $nick :$who doesn't have admin rights on $chan."
			return 1
		}
		return [do_mode $who $chan -a]            
	}
}
###
##
#

#
##
###
proc pub_eggserv_owner {nick host handle chan text} {
	global verbosemsgs debugmsgs servicechan
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [isowner $nick $chan] == 1} {	
		if {$who == ""} {set who $nick} 
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Channelname : $chan."}		
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Nickname : $who."}
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsOwner : [isowner [strlwr $who] $chan]"}
		if {[isowner [strlwr $who] $chan] == 1} {
			putserv "NOTICE $nick :$who is already has owner privileges on the $chan."
			return 1
		}
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		return [do_mode $who $chan +q]  
	}
}
###
##
#

#
##
###
proc pub_eggserv_deowner {nick host handle chan text} {
	global verbosemsgs debugmsgs servicechan
	set who [lindex $text 0]
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [isowner $nick $chan] == 1} {
		if {$who == ""} {set who $nick} 
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Channelname : $chan."}		
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :Nickname : $who."}
		if {$debugmsgs == 1 } {putserv "PRIVMSG $servicechan :IsOwner : [isowner [strlwr $who] $chan]"}
		if {![onchan $who $chan]} {
			putserv "NOTICE $nick :I dont see $who on $chan"
			return 1
		} 
		if {[isowner [strlwr $who] $chan] == 0} {
			putserv "NOTICE $nick :$who doesn't have owner privileges on $chan."
			return 1
		}
		return [do_mode $who $chan -q]            
	}
}
###
##
#



###########################################################################################
## Topic 
###########################################################################################

#
##
### Set Topic
proc pub_eggserv_topic {nick host handle chan text} {
	global botnick
	set topic [lrange $text 0 end]	
	set opper [nick2hand $nick $chan]
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
		[ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || \
		[isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1 } {	
		if {$topic == ""} {
			putserv "NOTICE $nick :Usage: !topic <Topic you want.>"
			return 1
		}		
		if {![botisop $chan] && ![isadmin $botnick $chan] == 1 && ![isowner $botnick $chan] == 1 && ![ishalfop $botnick $chan] == 1} {
			putserv "NOTICE $nick :Insufficient privileges to set the topic on $chan.>"
			return 1
		} 
		putserv "TOPIC $chan :$topic"
		return 1
	}
}
###
##
#

###########################################################################################
## Calculate 
###########################################################################################

proc time_diff2 {time} {
	set ltime [expr $time - [unixtime]]
	set seconds [expr $ltime % 60]
	set ltime [expr ($ltime - $seconds) / 60]
	set minutes [expr $ltime % 60]
	set ltime [expr ($ltime - $minutes) / 60]
	set hours [expr $ltime % 24]
	set days [expr ($ltime - $hours) / 24]
	set result ""
	if {$days} {
		append result "$days "
		if {$days} {
			append result "day "
		} {
			append result "days "
		}
	}
	if {$hours} {
		append result "$hours "
		if {$hours} {
			append result "hour "
		} {
			append result "hours "
		}
	}
	if {$minutes} {
		append result "$minutes "
		if {$minutes} {
			append result "minute"
		} {
			append result "minutes"
		}
	}
	if {$seconds} {
		append result " $seconds "
		if {$seconds} {
			append result "second"
		} {
			append result "seconds"
		}
	}
	return $result
}

proc charfilter {x {y ""} } {
	for {set i 0} {$i < [string length $x]} {incr i} {
		switch -- [string index $x $i] {
			"\"" {append y "\\\""}
			"\\" {append y "\\\\"}
			"\[" {append y "\\\["}
			"\]" {append y "\\\]"}
			"\} " {append y "\\\} "}
			"\{" {append y "\\\{"}
			default {append y [string index $x $i]}
		}
	}
	return $y
}

proc check {hand nick host} {
	global eggserv_ident eggserv_clones
	if {$eggserv_ident == 0} {return 1}
	if {[getuser $hand xtra auth] != "DEAD"} {
		set perm_host [getuser $hand xtra permident]
		if {[string match [strlwr $perm_host] [strlwr $nick!$host]]} { return 1	}
	}
	set host [lindex [split $host "@"] 1]
	if {[getuser $hand xtra auth] == 1} {
		if {$eggserv_clones == 1} {
			if {[getuser $hand xtra authhost] == $host} { return 1 }
		}
		if {[getuser $hand xtra authnick] == $nick} { return 1 }
	}
	return 0
}


proc checksilent {hand} {
	set temp [getuser $hand xtra silent]
	if {$temp == 1} {return 1}
	return 0
}

###########################################################################################
## Help 
###########################################################################################

proc pub_eggserv_help {nick host handle chan text} {
	global eggservvers botnick mgmttools
	set opper [nick2hand $nick $chan]
	putserv "NOTICE $nick :----------------\002 $botnick $eggservvers Help \002----------------"
	putserv "NOTICE $nick : !register       Registers a user to $botnick"
	putserv "NOTICE $nick : !drop           Drops a user registration from $botnick"
	putserv "NOTICE $nick : !assign         Assigns $botnick to a channel"
	putserv "NOTICE $nick : !unassign       Releases $botnick from the channel"
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || \
		[matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || \
		[matchattr $opper |+v $chan] || [ishalfop $nick $chan] == 1 || \
		[isop $nick $chan] == 1 || [isadmin $nick $chan] == 1 || \
		[isowner $nick $chan] == 1} {
	putserv "NOTICE $nick :----------------------------------------------------"
	putserv "NOTICE $nick : !voice          Voices a user"
	putserv "NOTICE $nick : !devoice        Devoices a user"
	}	
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || [ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || [isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
	putserv "NOTICE $nick : !halfop         Halfops a user"
	putserv "NOTICE $nick : !dehalfop       Dehalfops a user"
	}	
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [matchattr $opper |+o $chan] || [isop $nick $chan] == 1 || [isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
	putserv "NOTICE $nick : !op             Ops a user"
	putserv "NOTICE $nick : !deop           Deops a user"
	}
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
	putserv "NOTICE $nick : !protect        Protects a user"
	putserv "NOTICE $nick : !deprotect      Deprotects a user"
	}
	if {[matchattr $opper |+n $chan] || [isowner $nick $chan] == 1} {
	putserv "NOTICE $nick : !owner          Give owner status to a user"
	putserv "NOTICE $nick : !deowner        Takes owner status to a user"
	}
		if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || [ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || [isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
	putserv "NOTICE $nick :----------------------------------------------------"
	putserv "NOTICE $nick : !kick           Kicks a user"		
	putserv "NOTICE $nick : !ban            Bans a user"
	putserv "NOTICE $nick : !kickban        Kickbans a user"			
	putserv "NOTICE $nick : !unban          Unbans a user"
	}
		if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [matchattr $opper |+o $chan] || [matchattr $opper |+l $chan] || [ishalfop $nick $chan] == 1 || [isop $nick $chan] == 1 || [isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
	putserv "NOTICE $nick :----------------------------------------------------"
	putserv "NOTICE $nick : !addvop         Adds a user to the voice list"		
	putserv "NOTICE $nick : !delvop         Removes user from the voice list"
	putserv "NOTICE $nick : !addnop         Adds a user to the neverop list"		
	putserv "NOTICE $nick : !delnop         Removes user from the neverop list"		
	}
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [matchattr $opper |+o $chan] || [isop $nick $chan] == 1 || [isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
	putserv "NOTICE $nick : !addhop         Adds a user to the hop list"		
	putserv "NOTICE $nick : !delhop         Removes user from the hop list"	
	}	
	if {[matchattr $opper |+n $chan] || [matchattr $opper |+m $chan] || [isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {	
	putserv "NOTICE $nick : !addaop         Adds a user to the op list"		
	putserv "NOTICE $nick : !delaop         Removes user from the op list"
	}	
	if {[matchattr $opper |+n $chan] || [isowner $nick $chan] == 1} {
	putserv "NOTICE $nick : !addsop         Adds a user to the admin list"		
	putserv "NOTICE $nick : !delsop         Removes user from the admin list"	
	}
	if { $mgmttools == 1} {	
	if {[matchattr $nick +n $botnick] || [matchattr $nick +n $botnick] || [isadmin $nick $chan] == 1 || [isowner $nick $chan] == 1} {
	putserv "NOTICE $nick :----------------------------------------------------"
	putserv "NOTICE $nick : !status         Displays $botnick Status Messag"		
	putserv "NOTICE $nick : !rehash         Rehashes $botnick Config File"	
	putserv "NOTICE $nick : !reload         Reloads $botnick User Database"		
	putserv "NOTICE $nick : !restart        Restarts $botnick Services"
	}
	if {[matchattr $nick +n] } {	
	putserv "NOTICE $nick : !shutdown       Shuts $botnick Services down"		
	}
	}	
	putserv "NOTICE $nick :----------------\002 $botnick $eggservvers Help \002----------------"
}

putlog "EggServ.tcl $eggservvers TCL by Lupo Loaded"

#
##
### End of Script
Thanks!
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

That error is caused by this line of code in the script:

Code: Select all

puthelp "NOTICE $nick :\002Usage:\002 [string trim $!ban <nick|mask> \[time\] \[reason\]"
Looks to me like it has a couple of issues with that line.
Let's just try making that line look more like:

Code: Select all

puthelp "NOTICE $nick :\002Usage:\002 !ban <nick|mask> \[time\] \[reason\]"
See if that helps.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
d
desperado836
Voice
Posts: 2
Joined: Thu Nov 15, 2012 11:42 am

Post by desperado836 »

Thanks SpiKe^^, that seemed to fix the error, and I can ban/kickban just fine now. Thanks again!
Post Reply