Jos Decoster 22-dec-2006
To automatically redirect Eggdrop questions from #tcl to #eggtcl, I added this proc to tkchat:
proc ::tkchat::Bot { nick msg msgtype mark timestamp } { puts "Bot: nick=$nick msg=$msg msgtype=$msgtype mark=$mark timestamp=$timestamp" variable nick_seen if { ![string equal $msgtype NORMAL] } { puts "not NORMAL" return } if { [info exists nick_seen($nick)] && [expr {$timestamp - $nick_seen($nick)}] < 3600 } { puts "seen before" return } if { ![string match -nocase "*eggdrop*" $msg] } { puts "not about eggdrop" return } tkjabber::msgSend "$nick, for more information about eggdrop, also take a look at \#eggtcl or http://mini.net/tcl/16656" set nick_seen($nick) $timestamp }
and called it from ::tkchat::addMessage like this:
tkchat::Bot $nick $msg $msgtype $mark $timestamp