I was looking for an advertise script where a user can set the advertise message via a trigger and also have the timer set via the same trigger. How hard would it be to write a simple program to do the following.
<op> !notify <message> <timer> (time bind to time user used trigger, not to server clock.)
Example
12:55<op> !notify Forum is running slow, admins are working on the issue. 5 minutes
1:00<bot> Forum is running slow, admins are working on the issue
1:05<bot> forum is running slow, admins are working on the issue
1:10<bot> forum is running slow, admins are working on the issue
1:11<op>!notify off
Oh and it would need to be only able to be activated by an op.
# January 15, 2014
# http://forum.egghelp.org/viewtopic.php?t=19599
#############
# Usage:
# !notify <message> <number>
# !notify off
# !notify list
##############
bind pub o "!notify" pub_advert
proc pub_advert {nick uhost handle chan text} {
global botnick
if {![llength [split $text]] } {
putserv "privmsg $chan :Syntax: !notify <message> <number> or !notify off or !notify list"
return 0
}
if {[lindex [split $text] 0] == "off" && [llength [split $text]] == 1} {
if {![llength [timers]]} {
putserv "notice $nick :Sorry $nick, no matching timers found to kill"
return 0
}
foreach t_el [timers] {
if {[lindex $t_el 1 1] == $chan && [lindex $t_el 1 0] == "do_chan_announce"} {
killtimer [lindex $t_el 2]
putserv "notice $nick :killed timer id = [lindex $t_el 2]"
}
}
return 0
}
if {[lindex [split $text] 0] == "list" && [llength [split $text]] == 1} {
if {![llength [timers]]} {
putserv "notice $nick :Sorry $nick, no running timers for notify found"
return 0
}
foreach t_el [timers] {
putserv "notice $nick :$t_el"
}
return 0
}
set timer_min [lindex [split $text] end]
if {![string is integer $timer_min]} {
putserv "privmsg $chan :Sorry $nick, \"$timer_min\" is not a valid number for timer minutes."
putserv "privmsg $chan :Syntax: !notify <message> <number>"
return 0
}
set message [lrange [split $text] 0 end-1]
timer $timer_min [list do_chan_announce $chan $timer_min $message]
putserv "notice $nick :Timer is set. $botnick will announce in $chan \"$message\" every $timer_min minutes."
}
proc do_chan_announce {chan timer_min message} {
putserv "privmsg $chan :$message"
timer $timer_min [list do_chan_announce $chan $timer_min $message]
}
## References for you:
## http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
## http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
As it is above, bot will only respond to the !notify command when it is from a user that has +o in the bot's user list.
If the user is a chan op or not, in the channel is not relevant.
I hope this helps.
p.s. Tested briefly. It worked, and seemed to do what you requested. I hope nothing was lost in copy-n-paste to here.