| View previous topic :: View next topic |
| Author |
Message |
Diamond85 Voice
Joined: 25 Oct 2008 Posts: 27
|
Posted: Fri Dec 21, 2012 1:17 pm Post subject: [SOLVED] Need help on throttled |
|
|
this is from: http://forum.egghelp.org/viewtopic.php?t=9009#45537
| 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)"
}
} |
I've got a question times how I can query the seconds that are still open?
if 60 sekungen are set.
wait 35 seconds.
If the user then the commands used. say to the bot may wish to wait 25 seconds.
is that possible?
Last edited by Diamond85 on Fri Dec 21, 2012 8:11 pm; edited 1 time in total |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Fri Dec 21, 2012 5:11 pm Post subject: |
|
|
try this...
| Code: |
proc throttled {id time} {
global throttled
if {[info exists throttled($id)]} {
return [expr {($throttled($id)+$time)-[clock sec]}]
} {
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 time & id parts can be what ever you like of course)
Code:
bind pub n !test pub:test
proc pub:test {n u h c a} {
if {[set timeleft [throttled $u,$c 30]]} {
puthelp "PRIVMSG $c :$n: denied. (wait $timeleft seconds)"
} else {
puthelp "PRIVMSG $c :$n: allowed (wait 30 seconds)"
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
Diamond85 Voice
Joined: 25 Oct 2008 Posts: 27
|
Posted: Fri Dec 21, 2012 7:15 pm Post subject: |
|
|
thank you it works wonderfully!
SpiKe^^ have you a idea what I can do here to make it work?: Link |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Fri Dec 21, 2012 8:15 pm Post subject: |
|
|
Sorry, I know nothing about mysql or the tcl code needed to work it. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
|