This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Repeat protection on private.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
S
SaW
Voice
Posts: 8
Joined: Fri Jan 19, 2007 1:17 pm
Location: Turkey
Contact:

Repeat protection on private.

Post by SaW »

if the same message delivers to bot's private in 20 seconds three times, i want bot to add the message to spamfilter. This is similar with repeat protection on channel, but
the differnce between them is it doesnt matter the message sender dont have to be same nick.
i worked hard but i was not able to write the code..
Could you please help me?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind msgm - * repeat:spam

set spamFilter [list]

proc repeat:spam {nick uhost hand arg} {
 global spamRepeat spamFilter
 if {![info exists spamRepeat([set m [md5 [string tolower $arg]]])]} {
  set spamRepeat($m) 0
 }
 if {[incr spamRepeat($m)] >= 3 && [lsearch -exact $spamFilter [string tolower $arg]] == -1} {
  lappend spamFilter [string tolower $arg]
 }
 utimer 20 [list sr:decr $m]
}

proc sr:decr m {
 global spamRepeat
 if {[info exists spamRepeat($m)]} {
  incr spamRepeat($m) -1
  if {$spamRepeat($m) <= 0} {unset spamRepeat($m)}
 }
}
$spamFilter is the list of added lines.

Edit: Fixed error.
Last edited by Sir_Fz on Thu Jan 25, 2007 3:52 pm, edited 2 times in total.
S
SaW
Voice
Posts: 8
Joined: Fri Jan 19, 2007 1:17 pm
Location: Turkey
Contact:

Post by SaW »

Sir_Fz

[17:08] (LlranGe): [10:08] Tcl error [repeat:spam]: can't read "spamFilter": no such variable

it was not work.

And i mean with adding to spamfilter; e.x= /spamfilter add cpnNa gzline - Advertising spam mesaj
S
SaW
Voice
Posts: 8
Joined: Fri Jan 19, 2007 1:17 pm
Location: Turkey
Contact:

Post by SaW »

Code: Select all

bind msgm - * repeat:spam

proc repeat:spam {nick uhost hand arg} {
 global spamRepeat
 set SpamMsg $arg
 if {![info exists spamRepeat([set m [md5 [string tolower $arg]]])]} {
  set spamRepeat($m) 0
 }
 if {[incr spamRepeat($m)] >= 3 && [lsearch -exact $SpamMsg [string tolower $arg]] == -1} {
  lappend SpamMsg [string tolower $arg]
  putserv "SPAMFILTER add cpnNa gzline 30h advertising $arg"
 }
 utimer 20 [list sr:decr $m]
}

proc sr:decr m {
 global spamRepeat
 if {[info exists spamRepeat($m)]} {
  incr spamRepeat($m) -1
  if {$spamRepeat($m) <= 0} {unset spamRepeat($m)}
 }
}

i changed code to this type. it worked, but it is working if the message length more than one word. but it must work even the message length one word.. What should i do?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Your code changes the whole concept, I've fixed the code above.
Post Reply