# senotron/owo-bot architecture

> Architecture diagram of the GitHub repository senotron/owo-bot, 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/senotron/owo-bot
- Repository: https://github.com/senotron/owo-bot

## Overview

OwO Bot is a Discord game and social bot. Users issue prefix or slash commands and interact with Discord buttons and menus; command and interaction handlers produce game results, profile views, or collection updates backed by persistent profiles. The main domain stages are hunting and collecting, zoo and inventory management, battles, casino and lottery games, and social/profile features. Engines implement game rules, while the database and animal catalog provide shared internal layers. The README documents broader capabilities than the sampled excerpts; links for unsampled command behavior are therefore limited to documented relationships.

Main entry points: [`src/database/db.js`](https://github.com/senotron/owo-bot/blob/main/src/database/db.js) (Profile database), [`src/events/interactionCreate.js`](https://github.com/senotron/owo-bot/blob/main/src/events/interactionCreate.js) (Interaction handler), [`src/systems/huntEngine.js`](https://github.com/senotron/owo-bot/blob/main/src/systems/huntEngine.js) (Hunt engine), [`src/systems/battleEngine.js`](https://github.com/senotron/owo-bot/blob/main/src/systems/battleEngine.js) (Battle engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Discord entry points"]
  node_message_events["Message handler<br/>[messageCreate.js]"]
  node_interaction_events["Interaction handler"]
  node_startup["Bot startup<br/>[index.js]"]
end

subgraph group_commands["Commands and features"]
  node_hunt_cmd["Hunt command<br/>[hunt.js]"]
  node_zoo_cmd["Zoo and selling<br/>[zoo.js]"]
  node_inventory_cmd["Inventory and shop<br/>[inventory.js]"]
  node_battle_cmd["Battle and team<br/>[battle.js]"]
  node_slots_cmd["Slots command<br/>[slots.js]"]
  node_blackjack_cmd["Blackjack command<br/>[blackjack.js]"]
  node_coinflip_cmd["Coinflip command<br/>[coinflip.js]"]
  node_lottery_cmd["Lottery command<br/>[lottery.js]"]
  node_economy_cmd["Economy and social<br/>[economy.js]"]
  node_profile_cmd["Profile and marriage<br/>[profile.js]"]
  node_fun_cmd["Fun and OwOify<br/>[fun.js]"]
  node_help_cmd["Help command<br/>[help.js]"]
  node_stats_cmd["Stats command<br/>[stats.js]"]
end

subgraph group_gameplay["Game systems"]
  node_hunt_engine["Hunt engine<br/>[huntEngine.js]"]
  node_battle_engine["Battle engine<br/>[battleEngine.js]"]
  node_casino_engine["Casino engine<br/>[casinoEngine.js]"]
end

subgraph group_shared["Shared services"]
  node_animals["Animal catalog<br/>[animals.js]"]
  node_database[("Profile database<br/>[db.js]")]
  node_canvas["Profile card renderer<br/>[canvasCard.js]"]
end

node_user(("Discord user"))

node_user -->|"sends prefix command"| node_message_events
node_user -->|"uses slash command"| node_interaction_events
node_user -->|"uses components"| node_interaction_events
node_hunt_cmd -->|"runs hunt"| node_hunt_engine
node_hunt_engine -->|"selects animal"| node_animals
node_hunt_engine -->|"updates rewards"| node_database
node_interaction_events -->|"runs hunt again"| node_hunt_engine
node_zoo_cmd -->|"reads collection"| node_database
node_zoo_cmd -->|"looks up animals"| node_animals
node_interaction_events -->|"opens zoo view"| node_zoo_cmd
node_inventory_cmd -->|"manages inventory"| node_database
node_inventory_cmd -->|"uses animal data"| node_animals
node_battle_cmd -->|"runs battle"| node_battle_engine
node_battle_engine -->|"resolves combatants"| node_animals
node_battle_engine -->|"reads team and rewards"| node_database
node_interaction_events -->|"runs rematch"| node_battle_engine
node_slots_cmd -->|"plays slots"| node_casino_engine
node_coinflip_cmd -->|"plays coinflip"| node_casino_engine
node_casino_engine -->|"updates balance"| node_database
node_interaction_events -->|"replays wager"| node_casino_engine
node_blackjack_cmd -->|"reads and updates balance"| node_database
node_interaction_events -->|"handles game actions"| node_blackjack_cmd
node_lottery_cmd -->|"charges tickets"| node_database
node_economy_cmd -->|"manages economy"| node_database
node_profile_cmd -->|"reads and saves profile"| node_database
node_profile_cmd -->|"renders profile card"| node_canvas
node_stats_cmd -.->|"reads statistics"| node_database
node_startup -.->|"registers handler"| node_message_events
node_startup -.->|"registers handler"| node_interaction_events

click node_message_events "https://github.com/senotron/owo-bot/blob/main/src/events/messageCreate.js"
click node_interaction_events "https://github.com/senotron/owo-bot/blob/main/src/events/interactionCreate.js"
click node_startup "https://github.com/senotron/owo-bot/blob/main/src/index.js"
click node_hunt_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/hunt.js"
click node_zoo_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/zoo.js"
click node_inventory_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/inventory.js"
click node_battle_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/battle.js"
click node_slots_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/slots.js"
click node_blackjack_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/blackjack.js"
click node_coinflip_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/coinflip.js"
click node_lottery_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/lottery.js"
click node_economy_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/economy.js"
click node_profile_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/profile.js"
click node_fun_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/fun.js"
click node_help_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/help.js"
click node_stats_cmd "https://github.com/senotron/owo-bot/blob/main/src/commands/stats.js"
click node_hunt_engine "https://github.com/senotron/owo-bot/blob/main/src/systems/huntEngine.js"
click node_battle_engine "https://github.com/senotron/owo-bot/blob/main/src/systems/battleEngine.js"
click node_casino_engine "https://github.com/senotron/owo-bot/blob/main/src/systems/casinoEngine.js"
click node_animals "https://github.com/senotron/owo-bot/blob/main/src/systems/animals.js"
click node_database "https://github.com/senotron/owo-bot/blob/main/src/database/db.js"
click node_canvas "https://github.com/senotron/owo-bot/blob/main/src/utils/canvasCard.js"

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_message_events,node_interaction_events,node_startup,node_user toneBlue
class node_hunt_cmd,node_zoo_cmd,node_inventory_cmd,node_battle_cmd,node_slots_cmd,node_blackjack_cmd,node_coinflip_cmd,node_lottery_cmd,node_economy_cmd,node_profile_cmd,node_fun_cmd,node_help_cmd,node_stats_cmd toneAmber
class node_hunt_engine,node_battle_engine,node_casino_engine toneMint
class node_animals,node_database,node_canvas toneRose
```

## Components

### Discord entry points

- [Message handler](https://github.com/senotron/owo-bot/blob/main/src/events/messageCreate.js): `src/events/messageCreate.js`
- [Interaction handler](https://github.com/senotron/owo-bot/blob/main/src/events/interactionCreate.js): `src/events/interactionCreate.js`
- [Bot startup](https://github.com/senotron/owo-bot/blob/main/src/index.js): `src/index.js`

### Commands and features

- [Hunt command](https://github.com/senotron/owo-bot/blob/main/src/commands/hunt.js): `src/commands/hunt.js`
- [Zoo and selling](https://github.com/senotron/owo-bot/blob/main/src/commands/zoo.js): `src/commands/zoo.js`
- [Inventory and shop](https://github.com/senotron/owo-bot/blob/main/src/commands/inventory.js): `src/commands/inventory.js`
- [Battle and team](https://github.com/senotron/owo-bot/blob/main/src/commands/battle.js): `src/commands/battle.js`
- [Slots command](https://github.com/senotron/owo-bot/blob/main/src/commands/slots.js): `src/commands/slots.js`
- [Blackjack command](https://github.com/senotron/owo-bot/blob/main/src/commands/blackjack.js): `src/commands/blackjack.js`
- [Coinflip command](https://github.com/senotron/owo-bot/blob/main/src/commands/coinflip.js): `src/commands/coinflip.js`
- [Lottery command](https://github.com/senotron/owo-bot/blob/main/src/commands/lottery.js): `src/commands/lottery.js`
- [Economy and social](https://github.com/senotron/owo-bot/blob/main/src/commands/economy.js): `src/commands/economy.js`
- [Profile and marriage](https://github.com/senotron/owo-bot/blob/main/src/commands/profile.js): `src/commands/profile.js`
- [Fun and OwOify](https://github.com/senotron/owo-bot/blob/main/src/commands/fun.js): `src/commands/fun.js`
- [Help command](https://github.com/senotron/owo-bot/blob/main/src/commands/help.js): `src/commands/help.js`
- [Stats command](https://github.com/senotron/owo-bot/blob/main/src/commands/stats.js): `src/commands/stats.js`

### Game systems

- [Hunt engine](https://github.com/senotron/owo-bot/blob/main/src/systems/huntEngine.js): `src/systems/huntEngine.js`
- [Battle engine](https://github.com/senotron/owo-bot/blob/main/src/systems/battleEngine.js): `src/systems/battleEngine.js`
- [Casino engine](https://github.com/senotron/owo-bot/blob/main/src/systems/casinoEngine.js): `src/systems/casinoEngine.js`

### Shared services

- [Animal catalog](https://github.com/senotron/owo-bot/blob/main/src/systems/animals.js): `src/systems/animals.js`
- [Profile database](https://github.com/senotron/owo-bot/blob/main/src/database/db.js): `src/database/db.js`
- [Profile card renderer](https://github.com/senotron/owo-bot/blob/main/src/utils/canvasCard.js): `src/utils/canvasCard.js`

### Other components

- **Discord user**

## Connections

- Discord user → Message handler: sends prefix command (evidence: `README.md`)
- Discord user → Interaction handler: uses slash command (evidence: `README.md`)
- Discord user → Interaction handler: uses components (evidence: `README.md`)
- Hunt command → Hunt engine: runs hunt (evidence: `src/commands/hunt.js`)
- Hunt engine → Animal catalog: selects animal (evidence: `src/systems/huntEngine.js`)
- Hunt engine → Profile database: updates rewards (evidence: `src/systems/huntEngine.js`)
- Interaction handler → Hunt engine: runs hunt again (evidence: `src/events/interactionCreate.js`)
- Zoo and selling → Profile database: reads collection (evidence: `src/commands/zoo.js`)
- Zoo and selling → Animal catalog: looks up animals (evidence: `src/commands/zoo.js`)
- Interaction handler → Zoo and selling: opens zoo view (evidence: `src/events/interactionCreate.js`)
- Inventory and shop → Profile database: manages inventory (evidence: `src/commands/inventory.js`)
- Inventory and shop → Animal catalog: uses animal data (evidence: `src/commands/inventory.js`)
- Battle and team → Battle engine: runs battle (evidence: `src/commands/battle.js`)
- Battle engine → Animal catalog: resolves combatants (evidence: `src/systems/battleEngine.js`)
- Battle engine → Profile database: reads team and rewards (evidence: `src/systems/battleEngine.js`)
- Interaction handler → Battle engine: runs rematch (evidence: `src/events/interactionCreate.js`)
- Slots command → Casino engine: plays slots (evidence: `src/commands/slots.js`)
- Coinflip command → Casino engine: plays coinflip (evidence: `src/commands/coinflip.js`)
- Casino engine → Profile database: updates balance (evidence: `src/systems/casinoEngine.js`)
- Interaction handler → Casino engine: replays wager (evidence: `src/events/interactionCreate.js`)
- Blackjack command → Profile database: reads and updates balance (evidence: `src/commands/blackjack.js`)
- Interaction handler → Blackjack command: handles game actions (evidence: `src/events/interactionCreate.js`)
- Lottery command → Profile database: charges tickets (evidence: `src/commands/lottery.js`)
- Economy and social → Profile database: manages economy (evidence: `src/commands/economy.js`)
- Profile and marriage → Profile database: reads and saves profile (evidence: `src/commands/profile.js`)
- Profile and marriage → Profile card renderer: renders profile card (evidence: `src/commands/profile.js`)
- Stats command → Profile database: reads statistics
- Bot startup → Message handler: registers handler
- Bot startup → Interaction handler: registers handler
