| View previous topic :: View next topic |
| Author |
Message |
padyo Voice
Joined: 25 Jun 2008 Posts: 4
|
Posted: Sun Feb 06, 2011 1:31 pm Post subject: Throttling |
|
|
I've read may of the topics concerning throttling
| 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
}
}
|
and I can apply it to more basic commands, but am unsure of where to place this part of the code within the following....
if {[throttled $host,$chan 10]} {
return 0
} else {
| arfer wrote: | | Code: |
foreach dayname {sunday monday tuesday wednesday thursday friday saturday} {
bind PUB - !$dayname [list pDailySchedule $dayname]
}
proc pDailySchedule {dayname nick uhost hand chan text} {
if {[file exists ${dayname}.txt]} {
set id [open ${dayname}.txt r]
set schedule [split [read -nonewline $id] \n]
close $id
if {[llength $schedule] != 0} {
putserv "PRIVMSG $chan :Schedule for [string totitle $dayname]"
foreach item $schedule {
putserv "PRIVMSG $chan :$item"
}
} else {putserv "PRIVMSG $chan :There are no scheduled events for [string totitle $dayname]"}
} else {putserv "PRIVMSG $chan :Missing file ${dayname}.txt"}
return 0
}
|
|
If someone could give me a heads up, it would be appreciated  |
|
| Back to top |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Wed Feb 09, 2011 2:45 am Post subject: |
|
|
Just add it to this proc | Code: | proc pDailySchedule {dayname nick uhost hand chan text} {
if {[file exists ${dayname}.txt]} { | like so | Code: | proc pDailySchedule {dayname nick uhost hand chan text} {
if {[throttled $uhost,$chan 10]} {
putlog "* throttled: waiting 10 seconds.... (public command: !$dayname)"
return
}
if {[file exists ${dayname}.txt]} { |  _________________ TCL the misunderstood |
|
| Back to top |
|
 |
padyo Voice
Joined: 25 Jun 2008 Posts: 4
|
Posted: Thu Feb 10, 2011 9:05 am Post subject: |
|
|
| Cheers! Appreciate it. |
|
| Back to top |
|
 |
|