All pastes #770902 Raw Edit

channel greet

public text v1 · immutable
·published 2007-11-12 17:58 UTC
rendered paste body
set welc(msg1) "1st line message"
set welc(msg2) "2nd line message"
set welc(chan) "#subnet"
set welc(type) "1"

bind join - #subnet* givewelcome
proc givewelcome {nick uhost hand chan} {
  global welc

  set welctxt1 $welc(msg1)
  set welctxt2 $welc(msg2)
  regsub -all "%nick" $welctxt1 "$nick" welctxt1
  regsub -all "%nick" $welctxt2 "$nick" welctxt2
  regsub -all "%chan" $welctxt1 "$chan" welctxt1
  regsub -all "%chan" $welctxt2 "$chan" welctxt2
  switch $welc(type) {
    if {[onchan $nick $chan]}
    1 {
      utimer 5 puthelp "NOTICE $nick :$welctxt1"
      utimer 5 puthelp "NOTICE $nick :$welctxt2"
    }
    2 {
      utimer 5 puthelp "PRIVMSG $nick :$welctxt1"
      utimer 5 puthelp "PRIVMSG $nick :$welctxt2"
    }
  }
}
putlog "Channel Greeting"