Public feed #726019

Stuff

public text v1 · immutable
Raw Edit
·published 2007-10-04 20:45 UTC
rendered paste body
  if ($1 == ~vote) && (%voteon == 0) {
    set %voteon 1 | set %question $2- | msg # $nick has initiated a vote you have 60 seconds to say ~yes or ~no to the following question:  | msg # %question | /timer 1 60 msg # Times up! | set %votechan # | /timer 1 61 set %question 0 | /timer 1 61 set %voteon 0 | /timer 1 61 msg %votechan The Vote Rusults Are As Follows: | /timer 1 62 alias end
    alias end {
      msg %votechan YES = %yes
      msg %votechan NO = %no
      unset %voters.*
      set %yes 0
      set %no 0
    }
  }
  if ($1 == ~yes) {
    if (%voteon == 1) && (%voters. [ $+ [ $nick ] ] != $null) { msg # You have already voted, $nick | halt }
    if (%voteon == 1) && (%voters. [ $+ [ $nick ] ] == $null) {
      set %voters. [ $+ [ $nick ] ] $nick
      msg # $nick voted YES | inc %yes
    }
  }
  if ($1 == ~no) {
    if (%voteon == 1) && (%voters. [ $+ [ $nick ] ] != $null) { msg # You have already voted, $nick | halt }
    if (%voteon == 1) && (%voters. [ $+ [ $nick ] ] == $null) {
      set %voters. [ $+ [ $nick ] ] $nick
      msg # $nick voted NO | inc %no
    }
  }
  if (%voteon == 0) && ($1 == ~no) { 
    msg # A vote is currently not in progress!
  }
  if (%voteon == 0) && ($1 == ~yes) { 
    msg # A vote is currently not in progress!
  }
}