TCL Time Show

Time Show

# Set the next lines as the triggers and random responses you want
set ai_data {
 {
  {"What time is it?" "*time*" "What is the time?" "What's the time?" "Anyone have the time?"} {
   "$nick, it's [clock format [clock seconds]]"
  }
 }
}

# Set the next line as the channels you want to run in
set ai_chans "#test1, #test2"
bind pubm - * pub_ai

putlog "Time Show by Beliata"

proc pub_ai {nick uhost hand chan arg} {
 global ai_data ai_chans botnick
 if {(([lsearch -exact [string tolower $ai_chans] [string tolower $chan]] != -1) || ($ai_chans == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
  foreach block $ai_data {
   set triggers [lindex $block 0]
   set responses [lindex $block 1]
   foreach trigger $triggers {
    if {[string match [string tolower $trigger] [string tolower $arg]]} {
     putserv "PRIVMSG $chan :[subst [lindex $responses [rand [llength $responses]]]]"
    }
   }
  }
 }
}