Skip to content

Instantly share code, notes, and snippets.

@ProbablePrime
Created December 20, 2016 22:03
Show Gist options
  • Save ProbablePrime/153677e8bebcd06a2a9a0b44f794e1e2 to your computer and use it in GitHub Desktop.
Save ProbablePrime/153677e8bebcd06a2a9a0b44f794e1e2 to your computer and use it in GitHub Desktop.

Chat Poll Changelog

  • It is now valid to create polls without a duration and which must be manually halted. However after 30 days these polls will expire automatically.

  • The PollStart event is deprecated in favor of PollProgress.

  • A PollProgress event is formatted like so:

    {
        "question": "How's the weather?",
        "answers": [
            {
                "id": 0,
                "answer": "Good.",
                "responses": 2
            },
            {
                "id": 1,
                "answer": "Bad.",
                "responses": 12
            }
        ],
        "author": {
            "user_name": "USERNAME",
            "user_id": 12345,
            "user_roles": [
                "Mod"
            ]
        },
        "duration": 29996,
        "endsAt": 1465533783407,
        "voted": 1
    }

    voted indicates the option that the user voted for in the poll. The responses in this event will be null if voted is null. duration and endsAt will be null for polls without a termination.

    This event will be sent: - once when the poll is created - once to new users who join the channel - after the user votes for an option or forfeits their vote, periodically with the latest results

  • The PollEnd event has been changed to have an identical format as the PollProgress event.

  • The vote:choose method takes the response id instead of the index of the answer.

  • The vote:forfeit method has been added which causes the user to give up their vote. The response will be a PollProgress-formatted event with voted set to -1 and responses included.

  • A vote:end event has been added, which requires the poll_start permission. Calling this method will instantly end the ongoing poll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment