Add better #startvote error responses.

Add error responses for the three #startvote error states.
1. Person running #startvote is not the meeting chair.
2. A vote is already in progress.
3. The vote topic and options were not understood.

Change-Id: I9d86671179ceea1067f0641213eb5398d933d405
This commit is contained in:
Clark Boylan 2012-10-31 15:13:20 -07:00
parent 283507daf6
commit a306d7c1dc
2 changed files with 10 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.pyc

View File

@ -462,9 +462,16 @@ class MeetingCommands(object):
Format of command is #startvote $TOPIC $Options.
eg #startvote What color should we use? blue, red, green"""
if not self.isChair(nick) or self._voteTopic is not None: return
voteDetails = self.config.startvote_RE.match(line)
if voteDetails is None: return
if not self.isChair(nick):
self.reply("Only the meeting chair may start a vote.")
return
elif self._voteTopic is not None:
self.reply("Already voting on '%s'" % self._voteTopic)
return
elif voteDetails is None:
self.reply("Unable to parse vote topic and options.")
return
self._voteTopic = voteDetails.group("question")
voteOptions = voteDetails.group("choices")
if voteOptions == "":