set whatsapp(maxlength) 5
set whatsapp(unsettime) 20
bind pubm - * 112345check:whatsapp
proc 112345check:whatsapp {nick host hand chan text} {
global whatsapp
set text [stripcodes c $text]
if {![string match {*[0-9]*} $text]} { return 0 }
set nkls [chanlist $chan]
set tmptx ""
foreach word [split $text] {
set word [string trimright $word ":"]
if {[lsearch -nocase -exact $nkls $word] == -1} { append tmptx "$word " }
}
set digitcount [regexp -all {\d} $tmptx]
#putserv "PRIVMSG #test :$digitcount"
if {$digitcount == 0} { return 0 }
if {[info exists whatsapp($chan:$nick)]} { incr digitcount $whatsapp($chan:$nick) }
if {($digitcount >= $whatsapp(maxlength))} {
set chost [getchanhost $nick $chan]
set bmask m:[maskhost "$nick!$chost" 2]
pushmode $chan +b $bmask
after [expr {5*1000*1}] [list pushmode $chan -b $bmask]
#putserv "PRIVMSG $nick :you have been temporary mutebanned due to: excessive digits in your sentences"
putserv "NOTICE $nick :you have been temporary mutebanned due to: excessive digits in your sentences"
array unset whatsapp $chan:$nick
return 0
}
if {![info exists whatsapp($chan:$nick)]} {
utimer $whatsapp(unsettime) [list array unset whatsapp $chan:$nick]
}
set whatsapp($chan:$nick) $digitcount
return 0
}
i was wondering if we could have this code check if digits only in the sentence as we seem to get a lot of false positives especially with certain emoticons with digits in them
so for example trigger on only digits in sentence else ignore
so trigger on 12345
and not on 12345dfdf or kjskjs12345
ive messed with it to try and configure it that way but it seems no matter what i try i cant get it right