Discord: polls can be read but not voted in #118

Closed
opened 2026-09-06 12:04:28 -04:00 by Salastil · 1 comment
Owner

A Discord poll is drawn in the log - extract_poll reads the question and the answers
(backend/discord.rs:2142) - and that is as far as it goes. votePoll
(rpc/methods.rs:2945) dispatches to Matrix and to Kick and answers "that is not a
Kick channel"
for a Discord buffer, so the one thing a poll exists for cannot be
done here.

Kick and Matrix polls are both votable in moho already. Discord is the odd one out.

What is needed

  • POST /channels/{channel_id}/polls/{message_id}/answers/@me with the chosen answer
    id, through send_write so it obeys the pacing layer.
  • A Discord branch in votePoll rather than a second method - the client already
    calls one method for whatever service the conversation belongs to.
  • The result tally arrives on MESSAGE_UPDATE, which is already handled; the poll
    card should redraw from it.

Done looks like: pressing an answer in a Discord poll votes, and the counts move.

Reference: the official Discord client. Follows #109's card work.

A Discord poll is drawn in the log - `extract_poll` reads the question and the answers (`backend/discord.rs:2142`) - and that is as far as it goes. `votePoll` (`rpc/methods.rs:2945`) dispatches to Matrix and to Kick and answers **"that is not a Kick channel"** for a Discord buffer, so the one thing a poll exists for cannot be done here. Kick and Matrix polls are both votable in moho already. Discord is the odd one out. **What is needed** - `POST /channels/{channel_id}/polls/{message_id}/answers/@me` with the chosen answer id, through `send_write` so it obeys the pacing layer. - A Discord branch in `votePoll` rather than a second method - the client already calls one method for whatever service the conversation belongs to. - The result tally arrives on `MESSAGE_UPDATE`, which is already handled; the poll card should redraw from it. **Done looks like:** pressing an answer in a Discord poll votes, and the counts move. Reference: the official Discord client. Follows #109's card work.
Salastil added the featureprotocol labels 2026-09-06 12:04:28 -04:00
Salastil removed the protocol label 2026-09-06 12:49:13 -04:00
Author
Owner

Finished in nobilis 02e08f8.

A Discord poll now lands on the same card a Kick poll or a Matrix one does - one question with a set of answers and a tally is one shape whoever is asking - so this was a card builder, somewhere to announce from, and a Discord branch in votePoll rather than a second method. PUT /channels/{id}/polls/{message_id}/answers/@me, through send_write so it is paced like everything else this account does rather than reads.

Three things the payload's shape forced, worth writing down:

  • A Discord poll is part of a message rather than an event of its own, so the card's id is the message id - that is what a vote is addressed to.
  • The announce sits above the MESSAGE_UPDATE handler's early return. An update carrying a recounted tally has no edit stamp and no embeds, so it would otherwise have been read as nothing having happened - which would have meant the counts never moved.
  • answer_counts is absent entirely until the first vote, so a missing entry is nought rather than missing data.

A poll is treated as shut two ways: Discord saying the counting is finalised, and a clock that has run out while Discord has not got round to saying so. Offering a vote that would be refused is worse than saying it is closed.

History announces a poll too, but only while it is still running. Discord's polls last hours or days, so one posted before the conversation was opened is the commonest one to meet; a finished poll is history and stays in the log where it was written.

No client change was needed - the card and votePoll were already service-agnostic.

Finished in nobilis [02e08f8](https://git.salastil.com/Salastil/nobilis/commit/02e08f8). A Discord poll now lands on the same card a Kick poll or a Matrix one does - one question with a set of answers and a tally is one shape whoever is asking - so this was a card builder, somewhere to announce from, and a Discord branch in `votePoll` rather than a second method. `PUT /channels/{id}/polls/{message_id}/answers/@me`, through `send_write` so it is paced like everything else this account does rather than reads. Three things the payload's shape forced, worth writing down: - A Discord poll is part of a message rather than an event of its own, so the card's id is the **message** id - that is what a vote is addressed to. - The announce sits **above** the MESSAGE_UPDATE handler's early return. An update carrying a recounted tally has no edit stamp and no embeds, so it would otherwise have been read as nothing having happened - which would have meant the counts never moved. - `answer_counts` is absent entirely until the first vote, so a missing entry is nought rather than missing data. A poll is treated as shut two ways: Discord saying the counting is finalised, and a clock that has run out while Discord has not got round to saying so. Offering a vote that would be refused is worse than saying it is closed. History announces a poll too, but only while it is still running. Discord's polls last hours or days, so one posted before the conversation was opened is the commonest one to meet; a finished poll is history and stays in the log where it was written. No client change was needed - the card and `votePoll` were already service-agnostic.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Salastil/moho#118