#by wiebe @ QuakeNet
#requires peak.tcl



#help peak pub
bind pubm fvlomn|fvlomn "% ${botnet-nick} help peak" c_peak:help:pub

proc c_peak:help:pub { nick uhost handle chan text } {
  lappend output "Usage: peak"
  lappend output "Shows the highest known user peak for the channel."
  if { [catch {set x [cnotice $nick $output]} error] || !$x } {
    foreach t $output { puthelp "NOTICE $nick :$t" }
  }
  putloglev c $chan "[lindex [split $text] 1]: $nick $uhost $handle $chan [join [lrange [split $text] 2 end]]"
}



#help peak msg
bind msgm fvlomn|fvlomn "help peak" c_peak:help:msg

proc c_peak:help:msg { nick uhost handle text } {
  lappend output "Usage: peak <channel>"
  lappend output "Shows the highest known user peak for the given channel."
  if { [catch {set x [cnotice $nick $output]} error] || !$x } {
    foreach t $output { puthelp "NOTICE $nick :$t" }
  }
  putcmdlog "($nick!$uhost) !$handle! $text"
}



#peak pub
bind pubm fvlomn|fvlomn "% ${botnet-nick} peak" c_peak:pub
bind pubm fvlomn|fvlomn "% ${botnet-nick} peak *" c_peak:pub

proc c_peak:pub { nick uhost handle chan text } {
  if { [catch {peak:pub $nick $uhost $handle $chan $text} error] } {
    putlog "ERROR using peak.tcl, perhaps you have not loaded it?"
  }
  putloglev c $chan "[lindex [split $text] 1]: $nick $uhost $handle $chan [join [lrange [split $text] 2 end]]"
}



#peak msg
bind msg fvlomn|fvlomn peak c_peak:msg

proc c_peak:msg { nick uhost handle text } {
  if { [catch {peak:msg $nick $uhost $handle $text} error] } {
    putlog "ERROR using peak.tcl, perhaps you have not loaded it?"
  }
  return 1
}

