Code: Select all
# time.tcl
# syntax !time <integer> <minute||second>
bind PUB - !time pTimeTrigger
proc pTimeTrigger {nick uhost hand chan text} {
set txt [split [string trim $text]]
if {[llength $txt] == 2} {
set number [lindex $txt 0]
set type [lindex $txt 1]
if {![string equal $number 0]} {
if {[string is integer $number]} {
switch -- $type {
minute {
pTimeStarted $number $type $chan
timer $number [list pTimeEnded $number $type $chan]
}
second {
pTimeStarted $number $type $chan
utimer $number [list pTimeEnded $number $type $chan]
}
}
}
}
}
return 0
}
proc pTimeStarted {number type chan} {
putserv "PRIVMSG $chan :Time Started ($number $type test) [ctime [unixtime]]"
return 0
}
proc pTimeEnded {number type chan} {
putserv "PRIVMSG $chan :Time Ended ($number $type test) [ctime [unixtime]]"
return 0
}