# fayzeen/rrb architecture

> Architecture diagram of the GitHub repository fayzeen/rrb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fayzeen/rrb
- Repository: https://github.com/fayzeen/rrb

## Overview

RRB is a Discord bot for UHC role predictions and persistent player drop profiles. The main workflow starts with a guild slash command: prediction selects a game mode and random role, records the drop, computes statistics, and replies with a Components V2 message; profile queries stored history and replies with ranking and the most-drawn role. The graph preserves the five role catalogs and the storage/query layer. Some implementation files were not sampled, so their internal relationships are omitted unless documented or referenced by sampled source.

Main entry points: [`src/main/java/fr/rrb/bot/drop/DropRepository.java`](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/drop/DropRepository.java) (Drop repository), [`src/main/java/fr/rrb/bot/Bot.java`](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/Bot.java) (Bot setup), [`src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java`](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java) (Mode handler), [`src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java`](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java) (Profile command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_discord["Discord / JDA"]
  node_entry["Startup entry<br/>[Main.java]"]
  node_bot["Bot setup<br/>[Bot.java]"]
  node_command_builder["Command interface"]
  node_placeholder["Message placeholders<br/>[Placeholder.java]"]
end

subgraph group_prediction["Predictions"]
  node_prediction_command["Prediction command"]
  node_mode_handler["Mode handler"]
  node_game_modes["Game modes<br/>[GameMode.java]"]
  node_role_catalogs["Role catalogs"]
  node_role_contract["Role contract<br/>[Role.java]"]
  node_prediction_message["Prediction message"]
end

subgraph group_profiles["Player profiles"]
  node_profile_command["Profile command"]
  node_profile_message["Profile message"]
  node_profile_stats["Profile statistics<br/>[ProfileStats.java]"]
end

subgraph group_persistence["Drop persistence"]
  node_database[("SQLite database<br/>[Database.java]")]
  node_drop_repository["Drop repository"]
  node_drop_requests["SQL requests<br/>[DropRequest.java]"]
  node_drop_stats["Drop statistics<br/>[DropStats.java]"]
end

node_discord_user(("Discord user"))

node_discord_user -.->|"invokes commands"| node_discord
node_entry -->|"starts"| node_bot
node_bot -->|"connects and registers"| node_discord
node_bot -->|"opens"| node_database
node_bot -->|"constructs with connection"| node_drop_repository
node_bot -->|"registers commands"| node_command_builder
node_bot -->|"registers"| node_prediction_command
node_bot -->|"registers"| node_profile_command
node_prediction_command -->|"dispatches to"| node_mode_handler
node_prediction_command -->|"passes repository"| node_drop_repository
node_mode_handler -->|"selects roles from"| node_game_modes
node_game_modes -->|"provides role sets"| node_role_catalogs
node_role_catalogs -->|"implements"| node_role_contract
node_mode_handler -->|"records and queries drop"| node_drop_repository
node_mode_handler -->|"uses statistics"| node_drop_stats
node_mode_handler -->|"formats response"| node_prediction_message
node_prediction_message -->|"formats with"| node_placeholder
node_mode_handler -->|"replies with prediction"| node_discord
node_profile_command -->|"queries profile"| node_drop_repository
node_drop_repository -->|"returns profile stats"| node_profile_stats
node_profile_command -->|"resolves role name"| node_game_modes
node_profile_command -->|"formats response"| node_profile_message
node_profile_message -->|"formats with"| node_placeholder
node_profile_command -->|"replies with profile"| node_discord
node_drop_repository -->|"executes SQL"| node_drop_requests
node_drop_repository -->|"builds query results"| node_drop_stats
node_drop_repository -.->|"queries connection"| node_database

click node_entry "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/Main.java"
click node_bot "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/Bot.java"
click node_command_builder "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/CommandBuilder.java"
click node_prediction_command "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionCommand.java"
click node_mode_handler "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java"
click node_game_modes "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/GameMode.java"
click node_role_catalogs "https://github.com/fayzeen/rrb/tree/main/src/main/java/fr/rrb/bot/command/defaults/prediction/role"
click node_role_contract "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/role/Role.java"
click node_prediction_message "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionMessage.java"
click node_profile_command "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java"
click node_profile_message "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/profile/ProfileMessage.java"
click node_profile_stats "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/profile/ProfileStats.java"
click node_database "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/database/Database.java"
click node_drop_repository "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/drop/DropRepository.java"
click node_drop_requests "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/drop/DropRequest.java"
click node_drop_stats "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/drop/DropStats.java"
click node_placeholder "https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/util/Placeholder.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_discord,node_entry,node_bot,node_command_builder,node_placeholder,node_discord_user toneBlue
class node_prediction_command,node_mode_handler,node_game_modes,node_role_catalogs,node_role_contract,node_prediction_message toneAmber
class node_profile_command,node_profile_message,node_profile_stats toneMint
class node_database,node_drop_repository,node_drop_requests,node_drop_stats toneRose
```

## Components

### Bot runtime

- **Discord / JDA**
- [Startup entry](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/Main.java): `src/main/java/fr/rrb/bot/Main.java`
- [Bot setup](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/Bot.java): `src/main/java/fr/rrb/bot/Bot.java`
- [Command interface](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/CommandBuilder.java): `src/main/java/fr/rrb/bot/command/CommandBuilder.java`
- [Message placeholders](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/util/Placeholder.java): `src/main/java/fr/rrb/bot/util/Placeholder.java`

### Predictions

- [Prediction command](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionCommand.java): `src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionCommand.java`
- [Mode handler](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java): `src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java`
- [Game modes](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/GameMode.java): `src/main/java/fr/rrb/bot/command/defaults/prediction/GameMode.java`
- [Role catalogs](https://github.com/fayzeen/rrb/tree/main/src/main/java/fr/rrb/bot/command/defaults/prediction/role): `src/main/java/fr/rrb/bot/command/defaults/prediction/role`
- [Role contract](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/role/Role.java): `src/main/java/fr/rrb/bot/command/defaults/prediction/role/Role.java`
- [Prediction message](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionMessage.java): `src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionMessage.java`

### Player profiles

- [Profile command](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java): `src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java`
- [Profile message](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/command/defaults/profile/ProfileMessage.java): `src/main/java/fr/rrb/bot/command/defaults/profile/ProfileMessage.java`
- [Profile statistics](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/profile/ProfileStats.java): `src/main/java/fr/rrb/bot/profile/ProfileStats.java`

### Drop persistence

- [SQLite database](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/database/Database.java): `src/main/java/fr/rrb/bot/database/Database.java`
- [Drop repository](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/drop/DropRepository.java): `src/main/java/fr/rrb/bot/drop/DropRepository.java`
- [SQL requests](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/drop/DropRequest.java): `src/main/java/fr/rrb/bot/drop/DropRequest.java`
- [Drop statistics](https://github.com/fayzeen/rrb/blob/main/src/main/java/fr/rrb/bot/drop/DropStats.java): `src/main/java/fr/rrb/bot/drop/DropStats.java`

### Other components

- **Discord user**

## Connections

- Discord user → Discord / JDA: invokes commands (evidence: `README.md`)
- Startup entry → Bot setup: starts (evidence: `src/main/java/fr/rrb/bot/Main.java`)
- Bot setup → Discord / JDA: connects and registers (evidence: `README.md`)
- Bot setup → SQLite database: opens (evidence: `src/main/java/fr/rrb/bot/Bot.java`)
- Bot setup → Drop repository: constructs with connection (evidence: `src/main/java/fr/rrb/bot/Bot.java`)
- Bot setup → Command interface: registers commands (evidence: `src/main/java/fr/rrb/bot/Bot.java`)
- Bot setup → Prediction command: registers (evidence: `src/main/java/fr/rrb/bot/Bot.java`)
- Bot setup → Profile command: registers (evidence: `src/main/java/fr/rrb/bot/Bot.java`)
- Prediction command → Mode handler: dispatches to (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionCommand.java`)
- Prediction command → Drop repository: passes repository (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionCommand.java`)
- Mode handler → Game modes: selects roles from (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java`)
- Game modes → Role catalogs: provides role sets (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/GameMode.java`)
- Role catalogs → Role contract: implements (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/role/AllStarsRole.java`)
- Mode handler → Drop repository: records and queries drop (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java`)
- Mode handler → Drop statistics: uses statistics (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java`)
- Mode handler → Prediction message: formats response (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java`)
- Prediction message → Message placeholders: formats with (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/PredictionMessage.java`)
- Mode handler → Discord / JDA: replies with prediction (evidence: `src/main/java/fr/rrb/bot/command/defaults/prediction/child/PredictionGameModeCommand.java`)
- Profile command → Drop repository: queries profile (evidence: `src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java`)
- Drop repository → Profile statistics: returns profile stats (evidence: `src/main/java/fr/rrb/bot/drop/DropRepository.java`)
- Profile command → Game modes: resolves role name (evidence: `src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java`)
- Profile command → Profile message: formats response (evidence: `src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java`)
- Profile message → Message placeholders: formats with (evidence: `src/main/java/fr/rrb/bot/command/defaults/profile/ProfileMessage.java`)
- Profile command → Discord / JDA: replies with profile (evidence: `src/main/java/fr/rrb/bot/command/defaults/profile/ProfileCommand.java`)
- Drop repository → SQL requests: executes SQL (evidence: `src/main/java/fr/rrb/bot/drop/DropRepository.java`)
- Drop repository → Drop statistics: builds query results (evidence: `src/main/java/fr/rrb/bot/drop/DropRepository.java`)
- Drop repository → SQLite database: queries connection
