JohnnyJayJay / instant-poll

A Discord bot that lets you create polls in your server
MIT License
42 stars 9 forks source link

Improve "Show votes" output #42

Open JohnnyJayJay opened 1 year ago

JohnnyJayJay commented 1 year ago

Currently, the show votes output is rather limited due to Discord's message limits.

To support arbitrary participant counts when showing votes, the current system should be refined in the following way:

  1. Construct the message text respecting message limits, splitting into multiple messages if necessary.
  2. If there are 6 or less resulting messages, send the response and up to 5 followup messages.
  3. If there are more than 6 resulting messages, format the results as a table and use a text file attachment.
JohnnyJayJay commented 1 year ago

The message can first be constructed like normal and then split on new lines when the limit is reached.

JohnnyJayJay commented 1 year ago

As it turns out, this is a bit difficult to accomplish because there's no confirmation when the interaction response comes through. Thus, there is a race condition between the initial response being accepted and the followup messages being sent. I would like to avoid implementing an artificial delay and "hoping for the best", so maybe another possibility could be a single message with some sort of pagination?