rendered paste bodyon $*:TEXT:/^[.!@]poll */Si:#: {
if (%poll == on) { notice $nick 14There is already a poll in12 $chan }
if (%poll == off) {
set %chan $chan
set %pstarter $nick
set %starttime $ctime
set %poll on
set %pollname $2-
msg %chan 12 %pstarter 14has started a vote - Question:12 $2- 14Vote lasts for 2 minutes. | msg $chan 14Vote by typing 12!yes 14or 12!no
timerpoll $+ $chan 1 120 endpoll }
}
alias endpoll {
msg %chan 14The voting has ended for -12 %pollname | msg %chan 14results - Yes:12 %pollyes | msg %chan 14 No:12 %pollno
unset %chan
unset %pstarter
unset %starttime
set %poll off
unset %pollname
unset %timeleft
set %pollyes 0
set %pollno 0
set %vote* off
}
on $*:TEXT:/^[.!@]yes/Si:#:{
if (%poll == off) {
notice %nick 14There isn't currently a poll.
}
else {
if (%vote [ $+ [ $nick ] ] == off || %vote [ $+ [ $nick ] ] == $null) && (%poll == on) {
set %vote [ $+ [ $nick ] ] on
inc %pollyes 1
notice $nick 14You voted12 yes 14in the poll.
}
}
}
on $*:TEXT:/^[.!@]no/Si:#:{
if (%poll == off) {
notice %nick 14There isn't currently a poll.
}
else {
if (%poll == on) && (%vote [ $+ [ $nick ] ] == on) { notice $nick 14You have already voted in the poll. }
if (%vote [ $+ [ $nick ] ] == off || %vote [ $+ [ $nick ] ] == $null) && (%poll == on) {
set %vote [ $+ [ $nick ] ] on
inc %pollno 1
notice $nick 14You voted12 no 14in the poll.
}
}
}
on $*:TEXT:/^[.!@]results/Si:#: {
if (%poll == on) && ($nick ison $chan) { set %timeleft $duration($calc( $ctime - %starttime )) | notice $nick 14Vote Question:12 %pollname | notice $nick 14Time Gone:12 %timeleft }
else { notice $nick 14There currently isn't a poll on12 $chan }
}
on $*:TEXT:/^[.!@]endpoll/Si:#: {
if (%poll == on) && ($nick == %pstarter) {
timerpoll [ $+ [ $chan ] ] off | endpoll }
else { notice $nick 14There currently isn't a poll on12 $chan }
}