Some checks failed
Deploy to Production / test (push) Failing after 33s
- Rewrite AGENTS and README files to match the current app layout - Document API routes, trivia UI, and the active panel design language
1.2 KiB
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
/triviachecks cooldown before deferring.startTrivia()deducts the entry fee and creates the session.getTriviaQuestionView()renders the prompt.trivia.interaction.tscompares the clicked answer with the session'scorrectIndex.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