I would like to get my bot to greet people as they enter the channel, but using a random string from a list. The code I'm using is as follows:-
Code: Select all
set greets {
"Hi $nick, good to see you"
"$nick, come on in and warm your feet"
"Look guys, it's $nick!"
}
proc user_join {nick uhost hand chan args} {
global greets
putchan $chan "[lindex $greets [rand [llength $greets]]]"
}
bind join * "*" user_join
It's working fine, except that the $nick variable is being parsed literally, with the greet coming out as "Look guys, it's $nick!" rather than "Look guys, it's AmazingWilf!". I've been browsing through tcl documentation for a couple of days now to try to figure out how I can get the interpreter to interpolate the value of $nick rather than the literal, but to no avail.
Can anyone help with this?
Thanks in advance,
David