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 

Repeat protection on private.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
SaW
Voice


Joined: 19 Jan 2007
Posts: 8
Location: Turkey

PostPosted: Tue Jan 23, 2007 5:42 pm    Post subject: Repeat protection on private. Reply with quote

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
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Jan 23, 2007 6:04 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
SaW
Voice


Joined: 19 Jan 2007
Posts: 8
Location: Turkey

PostPosted: Wed Jan 24, 2007 11:14 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
SaW
Voice


Joined: 19 Jan 2007
Posts: 8
Location: Turkey

PostPosted: Wed Jan 24, 2007 1:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Jan 24, 2007 3:54 pm    Post subject: Reply with quote

Your code changes the whole concept, I've fixed the code above.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
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