# yeasouh/pretzel-lover architecture

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

- Interactive diagram: https://gitdiagram.com/yeasouh/pretzel-lover
- Repository: https://github.com/yeasouh/pretzel-lover

## Overview

AU-Finder is a work-in-progress Discord bot. Its active workflow receives Discord gateway events, routes slash commands and modal submissions, and replies through Discord; message events trigger channel-specific automation. The source also contains planet database operations, though their command registrations and dispatch are commented out. Major runtime areas are represented, but several are connected only where the excerpts or source index establish a relationship; the README provides no further capability details.

Main entry points: [`src/commands.rs`](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands.rs) (Command routing), [`src/db/connection.rs`](https://github.com/yeasouh/pretzel-lover/blob/main/src/db/connection.rs) (Planet data access), [`src/main.rs`](https://github.com/yeasouh/pretzel-lover/blob/main/src/main.rs) (Startup and dispatcher), [`src/db.rs`](https://github.com/yeasouh/pretzel-lover/blob/main/src/db.rs) (Database module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_app["Startup and dispatcher<br/>[main.rs]"]
end

subgraph group_commands["Discord commands"]
  node_command_router["Command routing<br/>[commands.rs]"]
  node_say["Say command<br/>[say.rs]"]
  node_say_modal["Say modal<br/>[say.rs]"]
  node_edit_message["Message edit<br/>[edit.rs]"]
  node_edit_modal["Edit modal<br/>[edit.rs]"]
  node_morgoft["Morgoft command<br/>[morgoft.rs]"]
  node_purger["Expiring map purger<br/>[purge.rs]"]
end

subgraph group_planet["Planet records"]
  node_legacy_edit["Planet edit command<br/>[edit.rs]"]
  node_planet_get["Planet lookup command<br/>[get.rs]"]
  node_planet_search["Planet search command<br/>[search.rs]"]
  node_planet_remove["Planet removal command<br/>[remove.rs]"]
  node_planet_db["Planet data access<br/>[connection.rs]"]
  node_db_helpers["SQL helpers<br/>[helpers.rs]"]
  node_db_store[("Turso database<br/>[connection.rs]")]
  node_db_module["Database module<br/>[db.rs]"]
end

subgraph group_automation["Message automation"]
  node_msg_handler["Message handler<br/>[message.rs]"]
end

node_discord_user(("Discord user"))
node_gateway(("Discord gateway"))
node_discord_api(("Discord API"))

node_discord_user -->|"sends events"| node_gateway
node_gateway -->|"delivers events"| node_app
node_app -->|"dispatches commands"| node_command_router
node_app -->|"dispatches messages"| node_msg_handler
node_command_router -->|"routes say"| node_say
node_command_router -->|"routes edit"| node_edit_message
node_command_router -->|"routes selection"| node_morgoft
node_command_router -->|"routes modal"| node_say_modal
node_command_router -->|"routes modal"| node_edit_modal
node_say -->|"sends responses"| node_discord_api
node_say_modal -->|"sends messages"| node_discord_api
node_edit_message -->|"opens modal"| node_discord_api
node_edit_modal -->|"edits message"| node_discord_api
node_morgoft -->|"sends response"| node_discord_api
node_msg_handler -->|"replies and reacts"| node_discord_api
node_planet_get -->|"reads planet"| node_planet_db
node_planet_search -->|"searches planets"| node_planet_db
node_planet_remove -->|"removes planet"| node_planet_db
node_planet_db -->|"queries and updates"| node_db_store
node_db_module -->|"exposes access"| node_planet_db
node_db_module -->|"exposes helpers"| node_db_helpers
node_planet_db -.->|"uses SQL helpers"| node_db_helpers

click node_app "https://github.com/yeasouh/pretzel-lover/blob/main/src/main.rs"
click node_msg_handler "https://github.com/yeasouh/pretzel-lover/blob/main/src/message.rs"
click node_command_router "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands.rs"
click node_say "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/say.rs"
click node_say_modal "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/say.rs"
click node_edit_message "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/edit.rs"
click node_edit_modal "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/edit.rs"
click node_morgoft "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/morgoft.rs"
click node_purger "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/helpers/purge.rs"
click node_legacy_edit "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/edit.rs"
click node_planet_get "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/get.rs"
click node_planet_search "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/search.rs"
click node_planet_remove "https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/remove.rs"
click node_planet_db "https://github.com/yeasouh/pretzel-lover/blob/main/src/db/connection.rs"
click node_db_helpers "https://github.com/yeasouh/pretzel-lover/blob/main/src/db/helpers.rs"
click node_db_store "https://github.com/yeasouh/pretzel-lover/blob/main/src/db/connection.rs"
click node_db_module "https://github.com/yeasouh/pretzel-lover/blob/main/src/db.rs"

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_app,node_discord_user toneBlue
class node_command_router,node_say,node_say_modal,node_edit_message,node_edit_modal,node_morgoft,node_purger toneAmber
class node_legacy_edit,node_planet_get,node_planet_search,node_planet_remove,node_planet_db,node_db_helpers,node_db_store,node_db_module,node_discord_api toneMint
class node_msg_handler toneRose
class node_gateway toneIndigo
```

## Components

### Bot runtime

- [Startup and dispatcher](https://github.com/yeasouh/pretzel-lover/blob/main/src/main.rs): `src/main.rs`

### Discord commands

- [Command routing](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands.rs): `src/commands.rs`
- [Say command](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/say.rs): `src/commands/pretzel/say.rs`
- [Say modal](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/say.rs): `src/commands/pretzel/say.rs`
- [Message edit](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/edit.rs): `src/commands/pretzel/edit.rs`
- [Edit modal](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/edit.rs): `src/commands/pretzel/edit.rs`
- [Morgoft command](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/morgoft.rs): `src/commands/pretzel/morgoft.rs`
- [Expiring map purger](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/pretzel/helpers/purge.rs): `src/commands/pretzel/helpers/purge.rs`

### Planet records

- [Planet edit command](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/edit.rs): `src/commands/edit.rs`
- [Planet lookup command](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/get.rs): `src/commands/get.rs`
- [Planet search command](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/search.rs): `src/commands/search.rs`
- [Planet removal command](https://github.com/yeasouh/pretzel-lover/blob/main/src/commands/remove.rs): `src/commands/remove.rs`
- [Planet data access](https://github.com/yeasouh/pretzel-lover/blob/main/src/db/connection.rs): `src/db/connection.rs`
- [SQL helpers](https://github.com/yeasouh/pretzel-lover/blob/main/src/db/helpers.rs): `src/db/helpers.rs`
- [Turso database](https://github.com/yeasouh/pretzel-lover/blob/main/src/db/connection.rs): `src/db/connection.rs`
- [Database module](https://github.com/yeasouh/pretzel-lover/blob/main/src/db.rs): `src/db.rs`

### Message automation

- [Message handler](https://github.com/yeasouh/pretzel-lover/blob/main/src/message.rs): `src/message.rs`

### Other components

- **Discord user**
- **Discord gateway**
- **Discord API**

## Connections

- Discord user → Discord gateway: sends events
- Discord gateway → Startup and dispatcher: delivers events (evidence: `src/main.rs`)
- Startup and dispatcher → Command routing: dispatches commands (evidence: `src/main.rs`)
- Startup and dispatcher → Message handler: dispatches messages (evidence: `src/main.rs`)
- Command routing → Say command: routes say (evidence: `src/commands.rs`)
- Command routing → Message edit: routes edit (evidence: `src/commands.rs`)
- Command routing → Morgoft command: routes selection (evidence: `src/commands.rs`)
- Command routing → Say modal: routes modal (evidence: `src/commands.rs`)
- Command routing → Edit modal: routes modal (evidence: `src/commands.rs`)
- Say command → Discord API: sends responses (evidence: `src/commands/pretzel/say.rs`)
- Say modal → Discord API: sends messages (evidence: `src/commands/pretzel/say.rs`)
- Message edit → Discord API: opens modal (evidence: `src/commands/pretzel/edit.rs`)
- Edit modal → Discord API: edits message (evidence: `src/commands/pretzel/edit.rs`)
- Morgoft command → Discord API: sends response (evidence: `src/commands/pretzel/morgoft.rs`)
- Message handler → Discord API: replies and reacts (evidence: `src/message.rs`)
- Planet lookup command → Planet data access: reads planet (evidence: `src/commands/get.rs`)
- Planet search command → Planet data access: searches planets (evidence: `src/commands/search.rs`)
- Planet removal command → Planet data access: removes planet (evidence: `src/commands/remove.rs`)
- Planet data access → Turso database: queries and updates (evidence: `src/db/connection.rs`)
- Database module → Planet data access: exposes access (evidence: `src/db.rs`)
- Database module → SQL helpers: exposes helpers (evidence: `src/db.rs`)
- Planet data access → SQL helpers: uses SQL helpers (evidence: `src/db/helpers.rs`)
