Poll and prediction helpers put a Twitch poll or prediction into a reply. They come in two kinds, and the difference decides where you can use them.
The first kind asks Twitch at the moment the bot builds the reply. It reads the poll or prediction running now, or the last one that ended. You can use it in commands, event responses, timers, pipelines, Discord posts and webhook bodies, but not in a viewer’s own text.
The second kind are event values. They come with a poll or prediction event, so they work in an event response, in a pipeline started by that event, and in the Discord notifications Poll ends and Prediction resolved. Those two fill the listed values themselves (see In a Discord post). A command or a timer has no event to read them from.
So for an announcement when a poll ends, use the event values in that event response. For a command that viewers type mid-stream, use the helpers that read the prediction running now.
Before you start
The bot reads polls and predictions from your Twitch channel. For that, your Twitch connection needs two Twitch permissions: channel:read:polls for polls and channel:read:predictions for predictions. Your first Twitch sign-in does not ask for them. Without them, the helpers that read the running poll or prediction give nothing. The exceptions are {poll.isActive}, {poll.isTie} and {prediction.isActive}, which give false. These helpers read Twitch only, not other platforms.
To check and grant them, open Settings, then Integrations. The page opens with a notice such as “1 more Twitch permission to grant” that lists every permission still missing. If channel:read:polls or channel:read:predictions is on that list, choose Grant permissions, open the link, enter the code on Twitch and approve. Sign in to Twitch as the streamer’s own account when you approve, because the bot saves the permission on the account that approves the code.
The poll running now
Each of these is empty while no Twitch poll is running, except {poll.isActive} and {poll.isTie}, which give false.
| Helper | What it gives | Example |
|---|---|---|
{poll.question} | The question of the poll | Best snack? |
{poll.isActive} | true while a poll is running, else false | true |
{poll.timeLeft} | How long the poll has left | 1m 30s |
{poll.endsAt} | The time the poll ends, in the channel time zone | 15:32 |
{poll.options} | All options, separated by commas | chips, cookies |
{poll.options.numbered} | All options with their numbers | 1. chips 2. cookies |
{poll.option} | The text of the option with that number | {poll.option:2} gives cookies |
{poll.option.votes} | The votes of the option with that number | {poll.option.votes:2} gives 8 |
{poll.option.percent} | The share of the votes for the option with that number | {poll.option.percent:2} gives 40% |
{poll.leading} | The option with the most votes | chips |
{poll.leading.votes} | The votes of the leading option | 12 |
{poll.leading.percent} | The share of the votes for the leading option | 60% |
{poll.votes.total} | All votes in the poll | 20 |
{poll.isTie} | true when two or more options share the most votes | false |
{poll.results.bars} | Each option with a bar of 10 marks and its share | chips ██████░░░░ 60% · cookies ████░░░░░░ 40% |
Options count from 1, in the order Twitch lists them. A number past the last option gives nothing. A missing number, or anything that is not a whole number from 1 up, leaves the helper in the reply as written, braces and all.
A share is rounded to a whole percent, and a poll without votes gives 0%. Before the first vote, the three leading helpers are empty. When options tie, the leading option is the first of them in the list.
Vote counts are plain digits, with no thousands separators. {poll.endsAt} is rounded to the nearest minute and uses UTC when the channel has no time zone.
The last poll that ended
| Helper | What it gives | Example |
|---|---|---|
{poll.last.question} | The question of the last poll that ended | Best snack? |
{poll.last.winner} | The winning option of that poll | chips |
These read the bot’s saved record of Twitch poll events, newest first. They do not ask Twitch. A poll that ended while the bot was offline is not in the record. A poll counts however it ended, whether it ran its full time, was ended early or was removed. The bot’s own chat polls do not count.
The winner is the option with the most votes, and the first of them on a tie. When nobody voted, {poll.last.winner} is empty. Both helpers are empty until the bot has saved a finished poll.
The prediction running now
A prediction is running from the moment it opens until it is resolved or canceled. While it is locked, the bets are closed but the helpers still read it. Each of these is empty while no prediction is running, except {prediction.isActive}, which gives false.
| Helper | What it gives | Example |
|---|---|---|
{prediction.question} | The question of the prediction | Win? |
{prediction.isActive} | true while bets are open, false once it is locked or when none is running | true |
{prediction.status.now} | open while bets are open, locked once they are closed | open |
{prediction.timeLeft} | How long bets stay open; empty once locked | 45s |
{prediction.outcomes.list} | All outcomes, separated by commas | Yes, No |
{prediction.outcome} | The text of the outcome with that number | {prediction.outcome:2} gives No |
{prediction.outcome.points} | The channel points bet on the outcome with that number | {prediction.outcome.points:2} gives 1,000 |
{prediction.outcome.percent} | The share of all points on the outcome with that number | {prediction.outcome.percent:2} gives 25% |
{prediction.outcome.odds} | What the outcome with that number pays per point | {prediction.outcome.odds:2} gives 1:4 |
{prediction.leading} | The outcome with the most points | Yes |
{prediction.leading.points} | The channel points on the leading outcome | 3,000 |
{prediction.leading.percent} | The share of all points on the leading outcome | 75% |
{prediction.points.total} | All channel points bet | 4,000 |
{prediction.users.total} | How many people bet | 12 |
{prediction.topPredictor} | The person with the biggest bet, and its points | ViewerOne (1,000) |
Outcome numbers work like poll option numbers. Points and people are counted with the thousands separator of the channel language.
The odds are all points bet divided by the points on that outcome, to at most 2 decimals, like 1:1.33. An outcome without points has no odds, so it gives nothing. Before the first bet, the three leading helpers are empty and a share gives 0%.
The last prediction that ended
| Helper | What it gives | Example |
|---|---|---|
{prediction.last.winner} | The winning outcome of the last prediction that ended | Yes |
It reads the bot’s saved record of Twitch prediction events, newest first. It does not ask Twitch, and a prediction that ended while the bot was offline is not in the record. A canceled prediction has no winning outcome, so it gives nothing.
Event values
Each value below comes with the event named next to it. These are the poll and prediction events you can pick for an event response. All numbers here are plain digits, with no thousands separators.
| Helper | What it gives | Comes with | Example |
|---|---|---|---|
{poll.id} | The Twitch ID of the poll | Poll starts, Poll ends | ed961efd-8a3f-4cf5-a9d0-e616c590cd2a |
{poll.title} | The poll question | Poll starts, Poll ends | What next? |
{poll.duration} | How long the poll runs, in minutes, or in seconds when it is not whole minutes | Poll starts | 5 minutes |
{poll.choices} | All choices, separated by commas | Poll starts | Pizza, Pasta |
{poll.status} | How the poll ended, in the word Twitch uses | Poll ends | completed |
{poll.winner} | The choice with the most votes | Poll ends | Pizza |
{poll.winner.votes} | The votes of the winning choice | Poll ends | 28 |
{poll.winner.percentage} | The winning share in brackets, with a space in front; empty when nobody voted | Poll ends | {poll.winner}{poll.winner.percentage} gives Pizza (56%) |
{poll.results} | Every choice with its votes and share, separated by a bar | Poll ends | Pizza: 28 (56%) | Pasta: 22 (44%) |
{prediction.id} | The Twitch ID of the prediction | Prediction starts, Prediction locks, Prediction ends | 4de1a8b0-c3a0-4ed0-8b6f-7d1f0d1c2a11 |
{prediction.title} | The prediction question | Prediction starts, Prediction locks, Prediction ends | Will we win? |
{prediction.window} | How many seconds bets stay open | Prediction starts | 120 |
{prediction.outcomes} | All outcomes, separated by commas | Prediction starts | Yes, No |
{prediction.total_points} | All channel points bet when it locked | Prediction locks | 5000 |
{prediction.status} | How the prediction ended: resolved or canceled | Prediction ends | resolved |
{prediction.winner} | The winning outcome; empty when there is none | Prediction ends | Yes |
{prediction.winner.points} | The channel points bet on the winning outcome; 0 when there is none | Prediction ends | 3200 |
{prediction.winner.users} | How many people bet on the winning outcome; 0 when there is none | Prediction ends | 41 |
The Poll ends response runs only for a poll that ran its full time. A poll ended early or removed gets no response. The shares in {poll.winner.percentage} and {poll.results} are rounded down to a whole percent. Without votes, {poll.results} lists each choice with 0 and no share.
When nobody voted, {poll.winner} still gives the first choice, so the first example under Two replies side by side would announce a winner that did not win. Use the Discord notification if you want it to say nobody.
In a Discord post
The Discord notifications Poll ends and Prediction resolved fill some of these values themselves. Poll ends posts only for a poll that ran its full time, with {poll.title}, {poll.winner}, {poll.winner.votes} and {poll.results}. Here {poll.winner} gives nobody when nobody voted, and {poll.results} lists votes without shares, like Pizza: 28 | Pasta: 22.
Prediction resolved posts only for a prediction that has a winning outcome. It fills {prediction.title}, {prediction.winner}, {prediction.winner.points} and {prediction.winner.users}.
Two replies side by side
A Poll ends event response that announces the result:
Poll over! {poll.title} {poll.winner} wins{poll.winner.percentage}.
That posts Poll over! What next? Pizza wins (56%). in chat.
A command that viewers type while a prediction is open:
{prediction.question} {prediction.leading} leads with {prediction.leading.percent} of the points. Bets close in {prediction.timeLeft}.
While bets are open, that posts Win? Yes leads with 75% of the points. Bets close in 45s. Once the prediction locks, {prediction.timeLeft} is empty, so the last sentence reads oddly. Let the reply choose its last sentence with the {if.<path>.equals} test from Condition helpers:
{prediction.question} {prediction.leading} leads with {prediction.leading.percent} of the points. {if.prediction.status.now.equals:open:Bets close in {prediction.timeLeft}.|Bets are closed.}
While bets are open, that posts the same reply as before. Once the prediction locks, {prediction.status.now} gives locked, so the reply ends with Bets are closed.
Back to Template helpers. For how braces, inputs and nested helpers work, read Variables and templates.