but his script has some errors and he doesn't seems to give any support on it.
i fixed some options myself but i can't get the ban function to work.
i'll will only post the part that has todo with the banning part.
Code: Select all
set hopondeop 1
set kickondeop 1
set trigger {.}
set kickfile "kicks"
################################ C O N F I G U R A T I O N #################################
bind PUB n|o ${trigger}b modes:qban
bind PUB n|o ${trigger}ban modes:qban
bind PUB n|o ${trigger}ub modes:uban
bind PUB n|o ${trigger}unban modes:uban
bind PUB n|o ${trigger}unbanall modes:unbanall
#===========ban===========
proc modes:qban {nickname hostname handle channel arguments} {
global lastbind bantime reason bchan botname botnick kickfile bnick
if {[botisop $channel]} {
regexp -- {(\S+/)?} $kickfile tmp kickdir
if {$kickdir != ""} {
if {![file isdirectory $kickdir]} {
file mkdir $kickdir
}
}
if {![file exists "$kickfile"]} {
set file [open "$kickfile" w]
puts $file 0
close $file
}
set file [open "$kickfile" r]
gets $file count
close $file
set victim [lindex [modes:clean $arguments] 0]
if {$victim == ""} {
puthelp "NOTICE $nickname :${lastbind}: Not enough parameters."
return
}
set bantime [lindex [modes:clean $arguments] 1]
if {[regexp -- {^\d{1,4}$} $bantime]} {
if {$bantime > 1440} {set bantme 0}
set reason [lrange [modes:clean $arguments] 2 end]
} else {
set reason [lrange [modes:clean $arguments] 1 end]
set bantime 0
}
if {$reason == ""} {
set msges {
"Her lips suck forth / see where it flies"
"It's been nice knowing you.. well actually, it hasn't"
"Support Dan Quayle for President!"
"This random kick message was censored by popular request"
"I recommend you see a therapist"
"And quoth the raven, Nevermore"
"POP goes the weasel..."
"Look, no more lamer ^^"
"There's the exit, learn it well"
"This relationship just isn't going to work out"
"The op is always right"
"You are frightening our customers, we must ask you to leave"
"Random Kick Message #13"
"Out, damn spot, out I say"
"Excessive lameness detected"
"Shhh... Be vewy vewy qwiet... I'm hunting lamers..."
"My foot itches... ahh... much better..."
"Silly customer, you cannot harm the Twinkie!"
"Would you like fries with that?"
"P.S. This doesn't mean we can't be friends"
"I'm only doing this because I care"
"If you have to ask, you'll never know"
"This kick was sponsored in part by Microsoft Combat Boots"
"It must be a monday... -sigh-"
}
set reason [lindex $msges [rand [llength $msges]]]
}
set bchan $channel ; set bnick $nickname
if {[string index $victim 0] == "#"} {
regsub -all -- "#" $victim "" victim
if {[string length $victim] == 1} {
puthelp "NOTICE $nickname :You can not ban a service bot. ([string toupper $victim])"
unset bchan ; unset reason ; unset bantime ; unset bnick
return
}
putquick "MODE $channel +b *!*@$victim.users.undernet.org"
if {$bantime != 0} {utimer [expr $bantime * 60] [list putquick "MODE $channel -b *!*@$victim.users.undernet.org"]}
unset bchan ; unset reason ; unset bantime ; unset bnick
return
} elseif {![onchan $victim $channel]} {
regsub -all {\*+} $victim {*} victim
array set ban {
# ident *
host *
}
if {[regexp {([^a-zA-Z0-9_\*\?\!\.\@\|`\^\-\[\]\{\}\\]|^(!@|!|@)$)} $victim]} {
putquick "NOTICE $nickname :Sorry, couldn't add that hostmask."
unset bchan ; unset reason ; unset bantime ; unset bnick
return
}
set ban(nick) $victim
if {[regexp -- {!} $victim]} {
regexp -- {^(.*?)!(.*?)(@(.*))?$} $victim tmp ban(nick) ban(ident) tmp ban(host)
} elseif {[regexp -- {@} $victim]} {
regexp -- {^(.+!)?(.*?)(@(.*))?$} $victim tmp ban(nick) ban(ident) tmp ban(host)
}
foreach item [array names ban] {
if {[string length $ban($item)] < 1} {
set ban($item) *
}
}
set victim $ban(nick)!$ban(ident)@$ban(host)
if {([regexp -all -- {!|@} $victim] > 2)} {
puthelp "NOTICE $nickname :Sorry, couldn't add that hostmask."
unset bchan ; unset reason ; unset bantime ; unset bnick
return
}
if {[string match -nocase [modes:clean $victim] $botnick!$botname]} {
incr count
putquick "KICK $channel $nickname :Do not try to ban me ($count)"
set file [open "$kickfile" w]
puts $file $count
close $file
unset bchan ; unset reason ; unset bantime ; unset bnick
return
} elseif {[string match -nocase [modes:clean $victim] $nickname!$hostname]} {
putquick "NOTICE $nickname :You can not ban yourself."
unset bchan ; unset reason ; unset bantime ; unset bnick
return
}
putquick "MODE $channel +b $victim"
if {$bantime != 0} {utimer [expr $bantime * 60] [list putquick "MODE $channel -b $victim"]}
foreach target [chanlist $channel] {
if {[string match -nocase [modes:clean $victim] $target![getchanhost $target $channel]]} {
incr count
putquick "KICK $channel $target :[join $reason { }] ($count)"
}
}
set file [open "$kickfile" w]
puts $file $count
close $file
unset bchan ; unset reason ; unset bantime ; unset bnick
return
}
if {[string equal -nocase $nickname $victim]} {
puthelp "NOTICE $nickname :You can not ban yourself."
unset bchan ; unset reason ; unset bantime ; unset bnick
return
}
if {[isbotnick $victim]} {
incr count
putquick "KICK $channel $nickname :Do not try to ban me ($count)"
set file [open "$kickfile" w]
puts $file $count
close $file
unset bchan ; unset reason ; unset bantime ; unset bnick
return
}
if {[string length $victim] == 1} {
puthelp "NOTICE $nickname :You can not ban a service bot. ([string toupper $victim])"
unset bchan ; unset reason ; unset bantime ; unset bnick
return
}
bind raw - "354" qban:get
putquick "WHO $victim n%na"
}
}
proc qban:get {from keyword text} {
global bchan reason bantime bnick kickfile
set file [open "$kickfile" r]
gets $file count
close $file
incr count
set victim "[lindex [modes:clean $text] 1]"
set authnick "[lindex [modes:clean $text] 2]"
if {$authnick == 0} {
set host [maskhost $victim![getchanhost $victim $bchan]]
} else {
set host *!*@$authnick.users.undernet.org
}
putquick "MODE $bchan -o+b $victim $host"
putquick "KICK $bchan $victim :[join $reason { }] ($count)"
if {$bantime != 0} {utimer [expr $bantime * 60] [list putquick "MODE $bchan -b $host"]}
unbind raw - "354" qban:get
set file [open "$kickfile" w]
puts $file $count
close $file
unset bchan ; unset reason ; unset bantime ; unset bnick
}
proc modes:unbanall {nick host hand chan arg} {
if {[botisop $chan]} {
set banlist ""
foreach ban [chanbans $chan] {
lappend banlist [lindex $ban 0]
}
set cnt 0
while {$cnt < [llength $banlist]} {
putquick "MODE $chan -bbbbbb [lindex $banlist $cnt] [lindex $banlist [expr $cnt + 1]] [lindex $banlist [expr $cnt + 2]] [lindex $banlist [expr $cnt + 3]] [lindex $banlist [expr $cnt + 4]] [lindex $banlist [expr $cnt + 5]]"
incr cnt 6
}
}
}
[Sir^Killalot] [17:17] Tcl error [modes:qban]: can't set "bnick": variable is array