poll_end
End a poll before its scheduled close time. After this, poll_vote is rejected and the results are final.
Request
Section titled “Request”{ "cmd": "poll_end", "poll_id": "3c9d2f61-5b7e-4a0f-9e2c-1d8a6b4f0e57"}| Field | Type | Required | Description |
|---|---|---|---|
poll_id |
string | Yes | ID of the poll to end. Surrounding spaces are trimmed. |
Response
Section titled “Response”{ "cmd": "poll_end", "poll_id": "3c9d2f61-5b7e-4a0f-9e2c-1d8a6b4f0e57", "message_id": "8f14e45f-ceea-467a-9575-3d3b4c1b2a10", "channel": "general", "results": { "poll_id": "3c9d2f61-5b7e-4a0f-9e2c-1d8a6b4f0e57", "question": "When should we meet?", "allow_multiselect": false, "ended": true, "ended_at": 1788650000, "total_votes": 3, "results": [ { "id": "0", "text": "Monday", "votes": 1, "voters": ["bob"] }, { "id": "1", "text": "Tuesday", "votes": 2, "voters": ["alice", "carol"] } ] }}results has the same shape as in poll_vote, with ended: true and ended_at in Unix seconds. A poll in a thread also has thread_id; channel is then the parent forum.
The same frame is broadcast to every other connection whose user can view the channel, without listener.
Permissions
Section titled “Permissions”You must be able to view the poll, and be either:
- the user who created it, or
- a user with the
pinchannel permission in the poll’s channel. By default that is theowner,admin, andmoderatorroles.
The command is blocked while you are timed out.
Errors
Section titled “Errors”val |
When |
|---|---|
Poll not found |
No poll has this ID. |
You do not have permission to end this poll |
You didn’t create the poll and lack the pin permission. |
Poll has already ended |
The poll was already ended, or its expires_at has passed. |
Unable to save poll |
The server could not write the change to storage. |
Access denied to this channel |
You can’t view the poll’s channel. |
You do not have permission to view this thread |
You can’t view the parent forum of the poll’s thread. |
Channel not found or Thread not found |
The poll’s channel or thread no longer exists. |
| Validation message | poll_id is missing, not a string, or blank, for example poll_id: Required. |
