# tyr4/bot architecture

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

- Interactive diagram: https://gitdiagram.com/tyr4/bot
- Repository: https://github.com/tyr4/bot

## Overview

This repository is a Discord bot for Days Bygone game utilities and community features. Users invoke commands or interact with message components; the bot responds with calculations, wiki and spreadsheet help, deal information, image output, and community utilities. The principal path is Discord interaction → bot bootstrap and loaded cogs → feature-specific processing → Discord response, with some commands recording usage in wrapped.json. Several modules are only identified by the tree or SOURCE INDEX, so their internal behavior and unshown links are not inferred.

Main entry points: [`chestii/wrapped.py`](https://github.com/tyr4/bot/blob/main/chestii/wrapped.py) (Usage tracking), [`main.py`](https://github.com/tyr4/bot/blob/main/main.py) (Bot bootstrap), [`chestii/void_deals.py`](https://github.com/tyr4/bot/blob/main/chestii/void_deals.py) (Deal commands), [`chestii/formulas.py`](https://github.com/tyr4/bot/blob/main/chestii/formulas.py) (Game calculators)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bot["Bot bootstrap<br/>[main.py]"]
  node_extensions["Command extensions"]
  node_wrapped[("Usage tracking<br/>[wrapped.py]")]
end

subgraph group_game["Game utilities"]
  node_formulas["Game calculators<br/>[formulas.py]"]
  node_mob["Mob formulas<br/>[mob_formula.py]"]
  node_sheet["Sheet links<br/>[sheet.py]"]
  node_wiki["Wiki helper<br/>[wiki_commands.py]"]
  node_sheetupdate["Sheet updates<br/>[sheetupdate.py]"]
end

subgraph group_community["Community features"]
  node_fun["Fun commands<br/>[fun.py]"]
  node_funni["Community events<br/>[funni.py]"]
  node_rage["Rage commands<br/>[rage.py]"]
  node_jail["Jail features<br/>[jail.py]"]
  node_blackjack["Blackjack<br/>[blackjack.py]"]
  node_trol["Trol commands<br/>[trol.py]"]
  node_shopping["Shopping list<br/>[shopping_list.py]"]
end

subgraph group_deals["Void deals"]
  node_deals["Deal commands<br/>[void_deals.py]"]
  node_deal_image["Deal image rendering<br/>[image_gen.py]"]
end

node_user(("Discord user"))

node_user -->|"invokes commands"| node_bot
node_bot -->|"loads extensions"| node_extensions
node_bot -->|"registers view"| node_shopping
node_bot -->|"registers view"| node_deals
node_formulas -->|"uses formulas"| node_mob
node_formulas -->|"records usage"| node_wrapped
node_sheet -->|"records usage"| node_wrapped
node_wiki -->|"uses sheet links"| node_sheet
node_wiki -->|"records usage"| node_wrapped
node_fun -->|"records usage"| node_wrapped
node_funni -->|"records usage"| node_wrapped
node_funni -->|"uses deal features"| node_deals
node_deals -->|"uses image generator"| node_deal_image
node_deal_image -->|"gets deal data"| node_deals

click node_bot "https://github.com/tyr4/bot/blob/main/main.py"
click node_extensions "https://github.com/tyr4/bot/tree/main/chestii"
click node_formulas "https://github.com/tyr4/bot/blob/main/chestii/formulas.py"
click node_mob "https://github.com/tyr4/bot/blob/main/utils/mob_formula.py"
click node_sheet "https://github.com/tyr4/bot/blob/main/chestii/sheet.py"
click node_wiki "https://github.com/tyr4/bot/blob/main/chestii/wiki_commands.py"
click node_fun "https://github.com/tyr4/bot/blob/main/chestii/fun.py"
click node_funni "https://github.com/tyr4/bot/blob/main/chestii/funni.py"
click node_rage "https://github.com/tyr4/bot/blob/main/chestii/rage.py"
click node_jail "https://github.com/tyr4/bot/blob/main/chestii/jail.py"
click node_blackjack "https://github.com/tyr4/bot/blob/main/chestii/blackjack.py"
click node_trol "https://github.com/tyr4/bot/blob/main/chestii/trol.py"
click node_shopping "https://github.com/tyr4/bot/blob/main/chestii/shopping_list.py"
click node_wrapped "https://github.com/tyr4/bot/blob/main/chestii/wrapped.py"
click node_sheetupdate "https://github.com/tyr4/bot/blob/main/chestii/sheetupdate.py"
click node_deals "https://github.com/tyr4/bot/blob/main/chestii/void_deals.py"
click node_deal_image "https://github.com/tyr4/bot/blob/main/void_deals_image_gen/image_gen.py"

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_bot,node_extensions,node_wrapped,node_user toneBlue
class node_formulas,node_mob,node_sheet,node_wiki,node_sheetupdate toneAmber
class node_fun,node_funni,node_rage,node_jail,node_blackjack,node_trol,node_shopping toneMint
class node_deals,node_deal_image toneRose
```

## Components

### Bot runtime

- [Bot bootstrap](https://github.com/tyr4/bot/blob/main/main.py): `main.py`
- [Command extensions](https://github.com/tyr4/bot/tree/main/chestii): `chestii`
- [Usage tracking](https://github.com/tyr4/bot/blob/main/chestii/wrapped.py): `chestii/wrapped.py`

### Game utilities

- [Game calculators](https://github.com/tyr4/bot/blob/main/chestii/formulas.py): `chestii/formulas.py`
- [Mob formulas](https://github.com/tyr4/bot/blob/main/utils/mob_formula.py): `utils/mob_formula.py`
- [Sheet links](https://github.com/tyr4/bot/blob/main/chestii/sheet.py): `chestii/sheet.py`
- [Wiki helper](https://github.com/tyr4/bot/blob/main/chestii/wiki_commands.py): `chestii/wiki_commands.py`
- [Sheet updates](https://github.com/tyr4/bot/blob/main/chestii/sheetupdate.py): `chestii/sheetupdate.py`

### Community features

- [Fun commands](https://github.com/tyr4/bot/blob/main/chestii/fun.py): `chestii/fun.py`
- [Community events](https://github.com/tyr4/bot/blob/main/chestii/funni.py): `chestii/funni.py`
- [Rage commands](https://github.com/tyr4/bot/blob/main/chestii/rage.py): `chestii/rage.py`
- [Jail features](https://github.com/tyr4/bot/blob/main/chestii/jail.py): `chestii/jail.py`
- [Blackjack](https://github.com/tyr4/bot/blob/main/chestii/blackjack.py): `chestii/blackjack.py`
- [Trol commands](https://github.com/tyr4/bot/blob/main/chestii/trol.py): `chestii/trol.py`
- [Shopping list](https://github.com/tyr4/bot/blob/main/chestii/shopping_list.py): `chestii/shopping_list.py`

### Void deals

- [Deal commands](https://github.com/tyr4/bot/blob/main/chestii/void_deals.py): `chestii/void_deals.py`
- [Deal image rendering](https://github.com/tyr4/bot/blob/main/void_deals_image_gen/image_gen.py): `void_deals_image_gen/image_gen.py`

### Other components

- **Discord user**

## Connections

- Discord user → Bot bootstrap: invokes commands (evidence: `main.py`)
- Bot bootstrap → Command extensions: loads extensions (evidence: `main.py`)
- Bot bootstrap → Shopping list: registers view (evidence: `main.py`)
- Bot bootstrap → Deal commands: registers view (evidence: `main.py`)
- Game calculators → Mob formulas: uses formulas (evidence: `chestii/formulas.py`)
- Game calculators → Usage tracking: records usage (evidence: `chestii/formulas.py`)
- Sheet links → Usage tracking: records usage (evidence: `chestii/sheet.py`)
- Wiki helper → Sheet links: uses sheet links (evidence: `chestii/wiki_commands.py`)
- Wiki helper → Usage tracking: records usage (evidence: `chestii/wiki_commands.py`)
- Fun commands → Usage tracking: records usage (evidence: `chestii/fun.py`)
- Community events → Usage tracking: records usage (evidence: `chestii/funni.py`)
- Community events → Deal commands: uses deal features (evidence: `chestii/funni.py`)
- Deal commands → Deal image rendering: uses image generator (evidence: `chestii/void_deals.py`)
- Deal image rendering → Deal commands: gets deal data (evidence: `void_deals_image_gen/image_gen.py`)
