ALIAS EndPoll { VAR %pollhash = $+(Poll.,$1) IF ($hget(%pollhash)) { msg $1 Poll $qt($hget(%pollhash,Question)) has Ended. msg $1 Results: $+(,$hget(%pollhash,Yes),) People Voted Yes, $+(,$hget(%pollhash,No),) People Voted No. hfree %pollhash } } ON *:JOIN:#:{ VAR %pollhash = $+(Poll.,$chan), %output = .notice $nick [04Poll]: IF (($hget(%pollhash)) && (!$hget(%pollhash,$address($nick,3)))) { %output There is currently a Poll to vote on, created by $hget(%pollhash,Started) %output Poll Question: $hget(%pollhash,Question) %output Use !vote no or !vote yes to place your vote. } } ON *:TEXT:*:#:{ VAR %pollhash = $+(Poll.,$chan), %output = .notice $nick [04Poll]: IF ($regex($1-2,/^[!@.](Vote|Poll).(Start|Begin|New)$/Si)) { IF (($nick !isop $chan) && ($nick !ishop $chan)) return IF ($hget(%pollhash)) { %output There is already a Poll running on $chan $+ , Please end it before starting a new one. | return } IF ($3 !isnum) { %output Usage: !poll start | return } hadd -m %pollhash Question $4- hadd -m %pollhash Started $nick hadd -m %pollhash Yes 0 hadd -m %pollhash No 0 $+(.timerpoll,$chan) 1 $calc($3 * 60) EndPoll $chan msg $chan $3 Minute Poll: $qt($4-) - Started By: $nick msg $chan To Vote: !vote yes or !vote no } ELSEIF ($regex($1-2,/^[!@.](Vote|Poll).(Stop|End|Halt)$/Si)) { IF (($nick !isop $chan) && ($nick !ishop $chan)) return IF (!$hget(%pollhash)) { %output There is no poll open for $chan $+ ! | return } EndPoll $chan } ELSEIF ($regex($1-2,/^[!@.]Vote.(Yes|No)$/Si)) { IF (!$hget(%pollhash)) { %output There is no Poll open for $chan $+ ! | return } IF ($hget(%pollhash,$address($nick,3))) { %output You've already voted $upper($ifmatch) for this Poll! | return } %output You have now voted $+(,$upper($2),) for this Poll. hadd -m %pollhash $address($nick,3) $2 hinc -m %pollhash $2 } }