All pastes #446564 Raw Edit

Mine

public text v1 · immutable
·published 2007-04-18 15:48 UTC
rendered paste body
on $*:TEXT:/^[@!](vote|rate)/Si:#: {
  if ($read(vote.txt, s, $nick)) {
    notice $nick 12[14Vote12]14 You have allready voted
    halt
  }
  elseif ($2 >= 0 && $2 <= 10) {
    write vote.txt $nick $2
    write votes.txt $2
    notice $nick 12[14Vote12]14 You have rated the bot:12 $2 $+ /10 $+ 14. To check the results type12 !results 
    halt
  }
  else {
    notice $nick 12[14Vote12]14 Please rate the bot from 0 to 10
  }
}

on $*:TEXT:/^[@!]result/Si:#: {
  var %c = 0, %line
  while (%c <= $lines(votes.txt)) {
    set %line %line $+ $iif(%line,$chr(43)) $read(votes.txt,%c)
    if ($numtok(%line,44) >= 1000) {
      $iif($left($1,1) == @,msg $chan,notice $nick) 12[14Vote12]14 Total votes:12 $lines(votes.txt) 14Votes:12 %line $+ +
      unset %line
    }
    inc %c
  }
  if (%line) $iif($left($1,1) == @,msg $chan,notice $nick) 12[14Vote12]14 Total votes:12 $lines(votes.txt) 14Average vote:12 $round($calc((%line) / $lines(votes.txt)),1) 
}