Basicly we have written this swear script for our network , but the bot seems to pick up empty spaces as one of the keywords , it there a way round this ?
bind pubm - * censor
proc censor {nick host hand chan rest } {
global botnick
if { $nick == $botnick } {
return 0
}
set badwords "test1 test2* etc* help"
set saidtxt [lrange $rest 0 end]
set bad_words [split $badwords]
set said_txt [split $saidtxt]
set runningA 1
set detected 0
set said_pos 0
set badlength [llength $bad_words]
set saidlength [llength $said_txt]
while { $runningA == 1 } {
set saidchk [lindex $said_txt $said_pos ]
set slist [join [list $saidchk] ]
set runningB 1
set bad_pos 0
while { $runningB == 1 } {
set badchk [lindex $bad_words $bad_pos ]
set blist [join [list $badchk ] ]
if { [string match $blist $slist] } {
set swearword $slist
set runningA 0
set runningB 0
set detected 1
}
if { $bad_pos == $badlength } {
set runningB 2
} else {
incr bad_pos
}
}
incr said_pos
if { $said_pos == $saidlength } {
set runningA 0
}
}
if { $detected } {
set cenlog [open ./censor/censor.log a+]
puts $cenlog "$nick said $swearword on $chan [time] [date]"
close $cenlog
punish $nick $host $hand $chan
}
return 0
}