#by wiebe @ QuakeNet
#requires rating.tcl




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

proc c_rating:help:pub { nick uhost handle chan text } {
  lappend output "Usage: rating"
  lappend output "Shows your channel activity for today and your total for the last 7 days."
  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 rating msg
bind msgm -|fvlomn "help rating" c_rating:help:msg

proc c_rating:help:msg { nick uhost handle text } {
  lappend output "Usage: rating <channel>"
  lappend output "Shows your channel activity for today and your total for the last 7 days on the given channel."
  if { [catch {set x [cnotice $nick $output]} error] || !$x } {
    foreach t $output { puthelp "NOTICE $nick :$t" }
  }
  putcmdlog "($nick!$uhost) !$handle! $text"
}



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



#rating msg
bind msg -|fvlomn rating c_rating:msg

proc c_rating:msg { nick uhost handle text } {
  if { [catch {rating:msg $nick $uhost $handle $text} error] } {
     putlog "ERROR using rating.tcl, perhaps you have not loaded it?"
     error $error
  }
  return 1
}

