Skip to content

Add Discord scheduling polls with interactive availability - #20

Open
nextinfinity wants to merge 1 commit into
mainfrom
feat/scheduling-polls
Open

nextinfinity wants to merge 1 commit into
mainfrom
feat/scheduling-polls

Conversation

@nextinfinity

Copy link
Copy Markdown
Owner

Summary

Adds Discord-native, date-only scheduling polls, with no external website required.

  • /poll opens a creation form for title, inclusive date range, and seven weekday checkboxes (all selected initially).
  • Dates accept M/D or MM-DD with year inference, or explicit YYYY-MM-DD. Inferred start dates use today in UTC; inferred end dates are relative to the start, including December–January rollover.
  • Members check available dates in a private form and can edit or withdraw their responses. Unchecked dates are unavailable; nonrespondents are not counted as unavailable. Longer polls use multiple checkbox groups in one form.
  • The original message displays a live, chronological availability list, highlighting the strongest dates. Details shows member responses with pagination.
  • The creator or server admins can finalize a date or cancel. Finalization can optionally create a Discord scheduled event, collecting time, timezone, duration, and voice channel/external location then.
  • SQLite persists polls, responses, message IDs, final dates, and event state. Compose mounts a writable persistent volume for the non-root bot.

Implementation notes

  • Poll interactions have their own listener so /poll can open a modal without the existing music/timer command listener deferring it first.
  • Default Administrator command permissions remain delegatable through Discord. Management controls separately enforce creator/admin access, and all poll interactions check guild and original-channel visibility.
  • Message edits are briefly batched and serialized per poll to prevent stale edits overwriting newer totals.
  • Event creation has a persisted exclusive claim and best-effort reconciliation against a bot-created event marker before retrying. Permission/API failures preserve the selected date.
  • Includes scripts/run-local.sh for a temporary-bot smoke test, with a hidden token prompt, and a detailed manual checklist in docs/scheduling.md.

Intentional v1 limits

  • Maximum 25 candidate dates within a 90-day range; creation only in standard server text channels.
  • Availability only: no Maybe state, times in voting, reminders, automatic closing, reopening, or automatic winner selection.
  • All controls/results are on the original message. No results lookup command or visible poll UUID; deleting the message makes the poll inaccessible in Discord.
  • No migration/compatibility logic for the earlier local prototype; its test database was reset. No existing production polling schema exists.

Testing

  • ./gradlew --no-daemon check shadowJar passes on JDK 25 and the latest main Gradle wrapper (9.8.1).
  • 121 tests pass, including existing music/timer tests and scheduling tests for date inference, weekday filtering, checkbox grouping/defaults, vote replacement/withdrawal, SQLite restart persistence, concurrent voters, stale closed-poll submissions, permissions, serialized updates, and event success/failure/retry handling.
  • Creation and response UI were iterated through live testing with a temporary Discord bot. The full event/permissions/restart/mobile smoke-test checklist is documented for further validation.

No bot tokens, test databases, or build artifacts are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant