(poll, msg, server)
Given a question and answers, present a poll
Given a question and answers, present a poll
Given a question and answers present a poll
def poll(poll, msg, server):
    """Given a question and answers, present a poll"""
    poll = remove_smart_quotes(poll.replace(u"\u2014", u"--"))

    try:
        args = ARGPARSE.parse_args(shlex.split(poll)).poll
    except ValueError:
        return ERROR_INVALID_FORMAT

    if not 2 < len(args) < len(POLL_EMOJIS) + 1:
        return ERROR_WRONG_NUMBER_OF_ARGUMENTS

    result = ["Poll: {}\n".format(args[0])]
    for emoji, answer in zip(POLL_EMOJIS, args[1:]):
        result.append(":{}: {}\n".format(emoji, answer))

    # for this we are going to need to post the message to Slack via Web API in order to
    #  get the TS and add reactions
    msg_posted = server.slack.post_message(
        msg["channel"],
        "".join(result),
        thread_ts=msg.get("thread_ts", None),
        as_user=server.slack.username,
    )
    ts = json.loads(msg_posted)["ts"]
    for i in range(len(args) - 1):
        server.slack.post_reaction(msg["channel"], ts, POLL_EMOJIS[i])
def poll ( poll , msg , server ) : poll = remove_smart_quotes ( poll . replace ( u"\u2014" , u"--" ) ) try : args = ARGPARSE . parse_args ( shlex . split ( poll ) ) . poll except ValueError : return ERROR_INVALID_FORMAT if not 2 < len ( args ) < len ( POLL_EMOJIS ) + 1 : return ERROR_WRONG_NUMBER_OF_ARGUMENTS result = [ "Poll: {}\n" . format ( args [ 0 ] ) ] for emoji , answer in zip ( POLL_EMOJIS , args [ 1 : ] ) : result . append ( ":{}: {}\n" . format ( emoji , answer ) ) # for this we are going to need to post the message to Slack via Web API in order to #  get the TS and add reactions msg_posted = server . slack . post_message ( msg [ "channel" ] , "" . join ( result ) , thread_ts = msg . get ( "thread_ts" , None ) , as_user = server . slack . username , ) ts = json . loads ( msg_posted ) [ "ts" ] for i in range ( len ( args ) - 1 ) : server . slack . post_reaction ( msg [ "channel" ] , ts , POLL_EMOJIS [ i ] )