Deleted some functions that I don't need, and I don't know are there are no errors. I don't want to crash the bot because of uptime.

Code: Select all
set jp(part) 3
set jpban_type 7
set jp(reason) "Banned: join/part"
setudef flag joinpart
bind part - * ban:jp
proc ban:jp {nick uhost hand chan arg} {
global jp botnick jpchan
if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan joinpart]} {
return
}
if {![info exists jpchan($chan)]} {
set jpchan($chan) 0
}
if {($chan == $botnick) || [matchattr $hand b] || [matchattr $hand fom|fom $chan]} {
return
}
if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$jp(part)}]} {
set banmask [jp:banmask $uhost $nick]
putquick "MODE $chan +b $banmask"
putserv "KICK $chan $nick :$jp(reason)"
}
}
proc jp:banmask {uhost nick} {
global jpban_type
switch -- $jpban_type {
1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
3 { set banmask "*!*$uhost" }
4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
default { set banmask "*!*@[lindex [split $uhost @] 1]" }
return $banmask
}
}