BadchanStackKicks
here is the code we work with hopefully someone knows a way to achieve what we desired with it:
Code: Select all
namespace eval whois {
bind cron - {*/5 * * * *} [namespace current]::whois:cron
setudef flag stackedwhois
proc whois:cron {min hour day month weekday} {
foreach channel [channels] {
if {![channel get $channel stackedwhois]} continue
if {![botisop $channel]} continue
foreach member [chanlist $channel] {
if {[isbotnick $member]} continue
if {[isop $member $channel] || [ishalfop $member $channel] || [matchattr [nick2hand $member] fon|fon $channel]} continue
lappend userList $member
}
if {[info exists userList]} { Stack:WHois $channel $userList }
}
}
proc Stack:WHois {chan userList {max 20}} {
set ::chanxer $chan
set userList [lsort -unique $userList]
set count [llength $userList]
set counter 0
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $userList 0 [expr {$max - 1}]] ","]
set userList [lreplace $userList 0 [expr {$max -1}]]
incr count -$max
} else {
set users [join $userList ","]
set count 0
}
incr counter 1
after [expr {$counter*5000}] [list putserv "Whois :$users"]
}
}
bind raw - 319 [namespace current]::Xbc_whoisX
proc whoisXUnbind {from key arg} {
unbind raw - 319 [namespace current]::Xbc_whoisX
}
proc Xbc_whoisX {from key arg} {
set BadChanList [list]
set arg [split $arg]
set nick [lindex $arg 1]
set chost [getchanhost $nick $::chanxer]
regsub -all -- ~ $chost "" chost
set listchans [lrange $arg 2 end]
regexp -- {^:?(.*)$} [join $listchans] -> text
set text [split $text]
set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
if {[regexp -nocase {gay|[sf]uck|cam|incest|sex|cum|teenwankin|jackinchat|bdsm|wtf|kcuf|TestChan} $text]} {
lappend BadChanList $nick
if {[string match -nocase "*@*irccloud*" $chost]} {
set ident [lindex [split $chost @] 0]
set xbmaskx [string map {sid id uid id} $ident]
set bmask *!*[string tolower $xbmaskx ]@*
if {![ischanban $bmask $::chanxer]} { pushmode $::chanxer +b $bmask }
} elseif {![string match -nocase "*@*irccloud*" $chost] && ![ischanban [maskhost $nick!$chost 2] $::chanxer]} {
set bmask [maskhost $nick!$chost 2]
if {![ischanban $bmask $::chanxer]} { pushmode $::chanxer +b $bmask }
}
}
if {[info exists BadChanList]} {[namespace current]::BadchanStackKicks $::chanxer $BadChanList }
}
proc BadchanStackKicks {chan kicklist {max 4}} {
set count [llength $kicklist]
set counter 0
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $kicklist 0 [expr {$max - 1}]] ","]
set kicklist [lrange $kicklist $max end]
incr count -$max
} else {
set users [join $kicklist ","]
set count 0
}
incr counter 1
after [expr {$counter*5000}] [list putnow "KICK $chan $users :BlackListed CHANNEL DETECTED"]
}
}
}
Much appreciated.