TCL Part Message

Part Message

# Sends a message to people who part the channel by slennox

set pm_chan(#test) "Thanks for visiting #test!"
set pm_chan(#test1) "Bye %nick!"

# Set this to 1 if you want part messages to be sent to recognised users.
set pm_allusers 0

# If you want the bot to send a notice instead of a msg, set this to
# "NOTICE". Otherwise, leave it set to "PRIVMSG".
set pm_send "PRIVMSG"

proc pm_message {nick uhost hand chan {msg ""}} {
  global pm_allusers pm_chan pm_send pm_sent
  if {((!$pm_allusers) && ($hand != "*"))} {return 0}
  set stlchan [string tolower $chan]
  if {[info exists pm_sent($stlchan:$uhost)]} {return 0}
  if {[info exists pm_chan($stlchan)]} {
    set pm_sent($stlchan:$uhost) 1
    timer 5 [split "unset pm_sent($stlchan:$uhost)"]
    set message $pm_chan($stlchan)
    regsub -all -- "%nick" $message $nick message
    puthelp "$pm_send $nick :$message"
  }
  return 0
}

bind part - * pm_message

if {![info exists nb_component([file tail [file rootname [info script]]])]} {
  putlog "Loaded partmsg.tcl v1.2 by slennox (active on [join [array names pm_chan] ", "])."
}
return