Files
aurorabot/bot/modules/trivia/README.md
syntaxbullet 6abbd4652a
Some checks failed
Deploy to Production / test (push) Failing after 33s
Refresh repository documentation
- Rewrite AGENTS and README files to match the current app layout
- Document API routes, trivia UI, and the active panel design language
2026-04-09 21:10:10 +02:00

1.2 KiB

Trivia UI

The trivia command uses Discord Components v2 for the question, result, and timeout states.

Files

bot/modules/trivia/
  trivia.types.ts
  trivia.view.ts
  trivia.interaction.ts

bot/commands/economy/trivia.ts
shared/modules/trivia/trivia.service.ts

What the view layer does

  • renders the active question as a Components v2 container
  • colors the container by difficulty
  • renders answer buttons from the session's shuffled answers
  • renders separate result and timeout views with disabled buttons

Current interaction flow

  1. /trivia checks cooldown before deferring.
  2. startTrivia() deducts the entry fee and creates the session.
  3. getTriviaQuestionView() renders the prompt.
  4. trivia.interaction.ts compares the clicked answer with the session's correctIndex.
  5. submitAnswer() finalizes the session and the view swaps to success, failure, or timeout output.

The command also schedules a timeout cleanup with a 5-second grace period after config.trivia.timeoutSeconds.

Custom IDs

  • answer buttons: TRIVIA_CUSTOM_IDS.ANSWER(sessionId, index)
  • give up: TRIVIA_CUSTOM_IDS.GIVE_UP(sessionId)
  • result/timeout buttons use non-interactive result IDs