11from re import findall
22
33from cloudbot import hook
4-
54from cloudbot .util .formatting import get_text_list
65
7-
86polls = {}
97
108
@@ -19,7 +17,7 @@ def __init__(self, title):
1917
2018
2119class Poll :
22- def __init__ (self , question , creator , options = [ "Yes" , "No" ] ):
20+ def __init__ (self , question , creator , options = ( "Yes" , "No" ) ):
2321 self .question = question
2422 self .creator = creator
2523 self .options = {i .lower (): PollOption (i ) for i in options }
@@ -65,6 +63,7 @@ def format_results(self):
6563
6664@hook .command ()
6765def poll (text , conn , nick , chan , message , reply ):
66+ """{<question>[: <option1>, <option2>[, <option3>]...|close} - Creates a poll for [question] with the provided options (default: Yes, No), or closes the poll if the argument is 'close'"""
6867 global polls
6968
7069 # get poll ID
@@ -104,7 +103,7 @@ def poll(text, conn, nick, chan, message, reply):
104103
105104@hook .command (autohelp = True )
106105def vote (text , nick , conn , chan , notice ):
107- """.vote <poll> <choice> - Vote on a poll; responds on error and silently records on success."""
106+ """<poll> <choice> - Vote on a poll; responds on error and silently records on success."""
108107 global polls
109108
110109 if len (text .split (' ' , 1 )) == 2 :
@@ -126,10 +125,9 @@ def vote(text, nick, conn, chan, notice):
126125 notice ("Voted \x02 \" {}\" \x02 on {}'s poll!" .format (o .title , p .creator ))
127126
128127
129- @hook .command (autohelp = Poll )
128+ @hook .command (autohelp = False )
130129def results (text , conn , chan , nick , message , reply ):
131- """[user] -- Shows current results from [user]'s poll. If [user] is empty,
132- it will show results for your poll."""
130+ """[user] - Shows current results from [user]'s poll. If [user] is empty, it will show results for your poll."""
133131 global polls
134132
135133 if text :
0 commit comments