rendered paste bodyon $*:TEXT:/^[@!.]startvote/Si:#: {
if ($nick isreg $chan) { HALT }
if (%votetext. [ $+ [ $chan ] ] == $null) {
/msg $chan Vote started by $nick - $2-
/msg $chan Vote will end in 2 minutes. Type !yes or !no
/timer 1 120 votealias $chan
/set %votenick. [ $+ [ $chan ] ] $nick
/set %votetext. [ $+ [ $chan ] ] $2-
}
else {
/msg $chan There's already a vote: %votetext. [ $+ [ $chan ] ]
}
}
on $*:TEXT:/^[@!.]endvote/Si:#: {
if (%votetext. [ $+ [ $chan ] ] == $null) {
$iif($left($1,1) == @,.msg $chan,.notice $nick) There is currently no vote.
halt
}
else {
/votealias $chan
}
}
alias votealias {
if (%voteyes. [ $+ [ $1 ] ] == $null) /set %voteyes. [ $+ [ $1 ] ] 0
if (%voteno. [ $+ [ $1 ] ] == $null) /set %voteno. [ $+ [ $1 ] ] 0
/msg $1 Vote by %votenick. [ $+ [ $1 ] ] - " $+ %votetext. [ $+ [ $1 ] ] $+ " has ended.
/msg $1 Ending Results: Yes: %voteyes. [ $+ [ $1 ] ] - No: %voteno. [ $+ [ $1 ] ]
/unset %votenick. [ $+ [ $1 ] ]
/unset %votetext. [ $+ [ $1 ] ]
/unset %vote. [ $+ [ * ] ] $+ . [ $+ [ $1 ] ]
/unset %voteyes. [ $+ [ $1 ] ]
/unset %voteno. [ $+ [ $1 ] ]
}
on $*:TEXT:/^[@!.]no/Si:#: {
if (%votetext. [ $+ [ $chan ] ] == $null) {
$iif($left($1,1) == @,.msg $chan,.notice $nick) There's currently no vote.
halt
}
if (%vote. [ $+ [ $address($nick,2) ] ] $+ . [ $+ [ $chan ] ] == $null) {
$iif($left($1,1) == @,.msg $chan,.notice $nick) You have now voted "No".
/inc %voteno. [ $+ [ $chan ] ] 1
/set %vote. [ $+ [ $address($nick,2) Voted
}
else {
$iif($left($1,1) == @,.msg $chan,.notice $nick) You have already voted.
}
}
on $*:TEXT:/^[@!.]yes/Si:#: {
if (%votetext. [ $+ [ $chan ] ] == $null) {
$iif($left($1,1) == @,.msg $chan,.notice $nick) There's currently no vote.
halt
}
if (%vote. [ $+ [ $address($nick,2) ] ] $+ . [ $chan ] ] == $null) {
$iif($left($1,1) == @,.msg $chan,.notice $nick) You have now voted "Yes".
/inc %voteyes. [ $+ [ $chan ] ] 1
/set %vote. [ $+ [ $address($nick,2) Voted
}
else {
$iif($left($1,1) == @,.msg $chan,.notice $nick) You have already voted.
}
}