egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

counting digits and if it exceeds threshold set mute
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Mon Nov 08, 2021 11:11 am    Post subject: Reply with quote

This is the complete updated code to this point...
Code:

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
}


_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Nov 08, 2021 11:23 am    Post subject: Reply with quote

i noticed if a nick has like [Guest]12345 and types his nick it doesnt get removed as well
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Nov 08, 2021 11:28 am    Post subject: Reply with quote

i also noticed if a nick like [Guest]12345 types like:

[Guest]12345 [Guest]12344 [Guest]12345 [Guest]12344 12

gets counted and reaches threshold while both nicks [Guest]12345 [Guest]12344 are on channel
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Mon Nov 08, 2021 12:00 pm    Post subject: Reply with quote

simo : I don't notice any of that weirdness happening.

Load the full patched version of the script from above.
You already verified [lsearch -nocase -exact... fixed that issue.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Nov 08, 2021 1:00 pm    Post subject: Reply with quote

yes i tested using ur latest posted code spike^^ it fixed the previous issue but for some reason the latter mentioned issue i noticed as well

ive loaded it in an active channel ill monitor it and get back at ya thanks so far spike^^ and CC
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Wed Dec 15, 2021 8:26 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Dec 15, 2021 8:41 am    Post subject: Reply with quote

If you want to check if a line contains only digits and spaces:
Code:
regsub -all -- {[0-9\ ] $text {} textbis
if {$textbis eq ""} {
   # do your stuff
}

_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Wed Dec 15, 2021 8:56 am    Post subject: Reply with quote

Thanks CC that seems to work well

besided the missing } wich i added at :

regsub -all -- {[0-9\ ]} $text {} textbis
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber