| View previous topic :: View next topic |
| Author |
Message |
tersayang Voice
Joined: 18 Apr 2007 Posts: 3
|
Posted: Sun May 13, 2007 3:59 am Post subject: !help once every 5 mins |
|
|
Hi there,
I have help bot, so when user type !help bnc the bot will respon and display the help contents. !help command only for user who have +v
Is it any other option some how, after the bot displayed help contents the bot will devoice the user and if the user type !help command again before 5 minutes the bot will message the nick " you can only use help command every 5 minutes" and the bot ignore that nick for 5 minutes.
thanks
Edit: Split this reply from Tcl Faq to this topic due to irrelevance. (Sir_Fz) |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun May 13, 2007 7:55 am Post subject: |
|
|
| Code: | bind pub - !help help:user
proc help:user {nick uhost hand chan arg} {
if {![isvoice $nick $chan]} {return 0}
if {![throttled $uhost:$chan 300]} {
# You can help $nick now
pushmode $chan -v $nick
} {
puthelp "notice $nick :you can only use help command every 5 minutes"
}
}
# user's throttled proc
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
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
tersayang Voice
Joined: 18 Apr 2007 Posts: 3
|
Posted: Mon May 21, 2007 1:07 am Post subject: !help timer |
|
|
Sir_Fz wrote
bind pub - !help help:user
proc help:user {nick uhost hand chan arg} {
if {![isvoice $nick $chan]} {return 0}
if {![throttled $uhost:$chan 300]} {
# You can help $nick now
pushmode $chan -v $nick
} {
puthelp "notice $nick :you can only use help command every 5 minutes"
}
}
# user's throttled proc
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
}
}
thanks Sir, it's work for all user, one thing how to give an exception to bot owner. let say the bot owner nick is "tersayang"
thanks |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Mon May 21, 2007 11:22 am Post subject: |
|
|
tersayang: Please edit your post and enclose the code in [code] tags. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue May 22, 2007 4:12 am Post subject: |
|
|
You can add
| Code: | | if {[matchattr $hand n|n $chan]} {return 0} |
in the help:user proc. This way it'll exempt owners. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|