Code: Select all
###################################
# Ai.tcl by KuNgFo0 (#eggfaq@efnet)
#VERSION 0.3
#DESCRIPTION Responds to certain words said in the set channels.
# Set the next lines as the triggers and random responses you want
# (wildcards may be used)
set ai_data {
{"Hello" "Hi" "Hey"} {
"Hey what's up, $nick?"
"Yo"
"Hello!"
}
{"What time is it?" "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 "#testchannel1 #testchannel2"
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 {triggers responses} $ai_data {
foreach trigger $triggers {
if {[string match [string tolower $trigger] [string tolower $arg]]} { putserv "PRIVMSG $chan :[subst [lindex $responses [rand [llength $responses]]]]" ; return }
}
}
}
}
bind pubm - * pub_ai
putlog "*** Ai.tcl 0.3 by KuNgFo0 loaded"
But the bot nickname variant is missing.
And I'd like to change this.
Code: Select all
{"Hello" "Hi" "Hey"} {
to use $botnick example: line 9
Code: Select all
{"Hello" "Hi $botnick" "$botnick Hey"} {
Could you help me get that variant?
I tried using this variant, but it doesn't work for me.
Code: Select all
regsub -all -- {$botnick} $responses $botnick responses