# Trivia UI The trivia command uses Discord Components v2 for the question, result, and timeout states. ## Files ```text 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