on *:TEXT:*:#: {
if ($1 == !poll) {
if ($nick !isop #) { return }
if ($2 == $null) { notice $nick Usage: !poll <question> | return }
set %poll.question $2-
msg # Poll: %poll.question ( $+ !vote <yes>|<no> $+ ) ( $+ 1min. remaining $+ )
.timer 1 60 stoppoll
set %chan # | set %yes 0 | set %no 0
}
if ($1 == !yes) {
notice $nick You voted for: yes
inc %yes 1
}
if ($1 == !no) {
notice $nick You voted for: no
inc %no 1
}
}
alias stoppoll {
msg %chan Stop voting! The poll is ready.
msg %chan Votes:
msg %chan Yes: %yes
msg %chan No: %no
if (%yes > %no) { msg %chan Winner: !yes with %yes votes | return }
if (%yes < %no) { msg %chan Winner: !no with %no votes | return }
unset %yes | unset %no | unset %chan | unset %poll.question
}