Starts with a slash command

Polls

Picking Friday's game by reaction works until people react to all three. /poll posts a button per answer and counts each member once. The person who asked closes the poll and gets the result.

Illustration. The real interface may look different.

How it works

  1. /poll opens a short form for the question and three answers.

  2. The bot posts the question with one button per answer.

  3. Each member has one vote, however often they click.

  4. Only the author can close the poll. Closing it posts the result.

How to make a poll with buttons on Discord

Every vote edits the same message, so the numbers on screen are the real ones. The counting sits in one shared flow that all three answer buttons call.

Describe it to your AI assistant

We argue about what to play every single week. Build a poll module: /poll opens a form for a question and three answers and posts one button per answer plus a Close poll button in #general. Each member gets one vote. Show the live counts on the message after every vote. Only the person who started the poll can close it. Closing shows the final result, removes the buttons and deletes what the poll stored.

Copy it and swap in your own channel and role names. Your assistant has a tested version of this example to start from.

Build it in the editor

Five flows: /poll, the submitted form, one flow per answer button, a shared flow that counts the vote, and Close. The three answer flows are copies that pass a different letter.

The 5 flows, step by stepStep names are the ones the editor shows.

Flow 1/poll

Trigger: Slash command/poll, with a one-minute cooldown per member.

  1. Show modalOpens the form for the question and the three answers.

Flow 2Form submitted

Trigger: Modal submittedmatched to the poll form.

  1. Build a shape valuePacks question, answers and author into one value.
  2. Create messageBuilds the poll message with a button per answer and the Close poll button.
  3. Send messagePosts it in the poll channel.
  4. Store a valueStores the poll under the ID of that message.

Flow 3Answer button

Trigger: Button clickedone flow per answer, three in total.

  1. Call another flowRuns the vote flow with the message, the voter and this button's answer.
  2. Update messageRewrites the poll message with the new counts.

Flow 4Count the vote

Trigger: Manual triggercalled by the three answer flows.

  1. Set stored value if (atomic)Claims a marker for this voter and this poll. If it is taken, the vote is refused.
  2. Add item to stored listAdds the voter to the poll's register, which the clean-up uses later.
  3. Increment if (atomic)Raises the count of the chosen answer. Two votes in the same instant both count.
  4. Return from flowHands the fresh counts back to the button flow.

Flow 5Close poll

Trigger: Button clickedfrom the Close poll button.

  1. Get a field of a shape valueReads the author from the stored poll.
  2. EqualsCompares them with the member who clicked. Anyone else gets a private refusal.
  3. Clear message buttonsRemoves all buttons.
  4. Update messageRewrites the message into the final result.
  5. Delete a stored valueDeletes the poll, its counts, its markers and its register.

Test it, change it

What it stores

  • PollBy custom keyQuestion, answers and author, filed under the ID of the poll message.
  • TallyBy custom keyOne number per answer.
  • VotedBy custom keyOne marker per voter and poll.
  • VotersBy custom keyThe register of everyone who voted in a poll. Everything is deleted when the poll closes.

How to test it

  1. Open a flow in the editor and click "Test run". Choose the member under "Run as" and click "Run test". The run uses your real server data but sends, changes and deletes nothing, and shows what each step would have done.
  2. A new flow is a "Draft" and does not run in Discord. Switch it on and click "Save & activate".
  3. In Discord, run /poll, vote with two accounts and try a second vote with one of them. Then click Close poll with the account that did not start it: it should be refused.
  4. Each real run then shows up under "Executions", with the reason if it failed or was skipped.

What to change

Channel
The poll channel is a setting in the module's "Configuration" tab.
Header
The line above every question is the "Poll header" setting.
Number of answers
A fourth answer needs a fourth form field, a fourth button and a fourth answer flow.
Who can start
Set "Required permissions" on the /poll trigger if only your team should run polls.

Watch out for

  • A poll has no end time. It keeps its data until the author closes it, so close old polls.
  • A vote cannot be changed after the click.
  • If the author leaves the server, nobody can close that poll with the button. Delete the message and clear its entries under "Stored data".

Questions about this build

Why build a poll when Discord has polls built in?

Discord's own polls work well for a quick question. One you build yourself posts in a fixed channel, keeps the result on the message for good and can be limited to the roles you choose.

Can members see who voted for what?

No. The message shows the counts only. The bot stores who has voted so it can refuse a second vote, and deletes that when the poll closes.

Can a poll close by itself after a day?

Not in this build. Ask your assistant to book the close with "Schedule flow run" when the poll is posted, the same way the giveaway example books its draw.

Tu veux faire entrer ton serveur dans la bêta ?

La V3 est un gros système qui évolue encore vite, donc les serveurs entrent un par un plutôt que tous d'un coup. Chaque candidature est lue par une personne, et tu as une réponse sous quelques jours.

Les serveurs déjà dans la bêta décident d'une bonne partie de ce que nous construisons ensuite. Ce que tu construis t'appartient : les flows et les modules restent à la fin de la bêta.