[General] Multi character prefix support for polls (#689)

This commit is contained in:
flapjax 2017-06-08 19:05:22 -04:00 committed by Twentysix
parent 820f62f94f
commit 3b93bb776a

View File

@ -339,7 +339,7 @@ class General:
if "@everyone" in check or "@here" in check:
await self.bot.say("Nice try.")
return
p = NewPoll(message, self)
p = NewPoll(message, " ".join(text), self)
if p.valid:
self.poll_sessions.append(p)
await p.start()
@ -377,13 +377,12 @@ class General:
return user.joined_at
class NewPoll():
def __init__(self, message, main):
def __init__(self, message, text, main):
self.channel = message.channel
self.author = message.author.id
self.client = main.bot
self.poll_sessions = main.poll_sessions
msg = message.content[6:]
msg = msg.split(";")
msg = [ans.strip() for ans in text.split(";")]
if len(msg) < 2: # Needs at least one question and 2 choices
self.valid = False
return None