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 

How to Ignore a trigger from a specific user for 3mns ?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
Sibelius
Voice


Joined: 18 Jan 2005
Posts: 3

PostPosted: Tue Jan 18, 2005 11:32 pm    Post subject: How to Ignore a trigger from a specific user for 3mns ? Reply with quote

Hello.
I run a tcl script which answers users ctcp triggers.
I wonder how to make the script ignore a trigger from one specific user for a 3 mns period.

Thanks in advance.

Sibelius
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Jan 19, 2005 4:37 am    Post subject: Reply with quote

Code:
newignore hostmask creator comment ?lifetime?
Back to top
View user's profile Send private message
Sibelius
Voice


Joined: 18 Jan 2005
Posts: 3

PostPosted: Wed Jan 19, 2005 6:54 am    Post subject: Reply with quote

Tks MeTroiD.

In fact, I dont want to ignore user completely.
I would need to only ignore his ctcp search trigger for some time but allow him to do other things with the bot.

I guess your solution totally ignore the user.
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Wed Jan 19, 2005 9:21 am    Post subject: something like this? Reply with quote

Code:
proc throttled {id seconds} {
   global throttle
   if {[info exists throttle($id)]&&$throttle($id)>[clock sec]} {
      set id 1
   } {
      set throttle($id) [expr {[clock sec]+$seconds}]
      set id 0
   }
}
# delete expired entries every 10 minutes
bind time - ?0* throttledCleanup
proc throttledCleanup args {
   global throttle
   set now [clock sec]
   foreach {id time} [array get throttle] {
      if {$time<=$now} {unset throttle($id)}
   }
}

...or using timers to do the cleanup
Code:
proc throttled {id time} {
   global throttled
   if {[info exists throttled($id)]} {
      return 1
   } {
      set throttled($id) [clock sec]
      utimer $time [list unset throttled($id)]
      return 0
   }
}

example limiting usage by same user@host on a specific channel
(the id part can be what ever you like of course)
Code:
bind pub n !test pub:test
proc pub:test {n u h c a} {
   if {[throttled $u,$c 30]} {
      puthelp "PRIVMSG $c :$n: denied. (wait or try a different channel)"
   } else {
      puthelp "PRIVMSG $c :$n: allowed (wait 30 seconds)"
   }
}

_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
Sibelius
Voice


Joined: 18 Jan 2005
Posts: 3

PostPosted: Wed Jan 19, 2005 5:05 pm    Post subject: Reply with quote

User,

Many Thanks for your very complete solution !
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive 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