| View previous topic :: View next topic |
| Author |
Message |
SaW Voice
Joined: 19 Jan 2007 Posts: 8 Location: Turkey
|
Posted: Tue Jan 23, 2007 5:42 pm Post subject: Repeat protection on private. |
|
|
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? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jan 23, 2007 6:04 pm Post subject: |
|
|
| Code: | 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. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts
Last edited by Sir_Fz on Thu Jan 25, 2007 3:52 pm; edited 2 times in total |
|
| Back to top |
|
 |
SaW Voice
Joined: 19 Jan 2007 Posts: 8 Location: Turkey
|
Posted: Wed Jan 24, 2007 11:14 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
SaW Voice
Joined: 19 Jan 2007 Posts: 8 Location: Turkey
|
Posted: Wed Jan 24, 2007 1:25 pm Post subject: |
|
|
| Code: | 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? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Jan 24, 2007 3:54 pm Post subject: |
|
|
Your code changes the whole concept, I've fixed the code above. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|