# ahnti/cheesy architecture

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

## Overview

This repository is a Discord bot with conversational AI, guild/user memory, utility commands, and a small fun-command cog. Users interact through Discord messages and commands; the bot may build AI context from conversation and stored memory, then respond in the channel. Other visible capabilities include image lookup, email sending, and YouTube audio extraction. The excerpts show only parts of main.py, so links to unsampled command registration and integrations are omitted; keep_alive.py is included as a separate web-server component, with no verified connection to startup.

Main entry points: [`main.py`](https://github.com/ahnti/cheesy/blob/master/main.py) (Discord bot), [`cogs/fun.py`](https://github.com/ahnti/cheesy/blob/master/cogs/fun.py) (Fun commands), [`keep_alive.py`](https://github.com/ahnti/cheesy/blob/master/keep_alive.py) (Keep-alive web server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Bot Runtime"]
  node_bot_runtime["Discord bot<br/>[main.py]"]
end

subgraph group_features["Bot Features"]
  node_ai_chat["AI chat<br/>[main.py]"]
  node_memory[("Conversation memory<br/>[main.py]")]
  node_main_commands["Bot commands<br/>[main.py]"]
  node_media_tools["YouTube audio<br/>[main.py]"]
  node_mail_command["Email command<br/>[main.py]"]
  node_fun_cog["Fun commands<br/>[fun.py]"]
end

subgraph group_service["Web Service"]
  node_keep_alive["Keep-alive web server<br/>[keep_alive.py]"]
end

node_discord_users(("Discord users"))
node_gemini{{"Gemini API"}}
node_safebooru{{"Safebooru API"}}
node_youtube{{"YouTube"}}
node_email_service{{"Email service"}}
node_web_monitor(("Web monitor"))

node_discord_users -->|"send messages"| node_bot_runtime
node_bot_runtime -->|"handles messages"| node_ai_chat
node_ai_chat -->|"builds context"| node_memory
node_ai_chat -->|"requests generation"| node_gemini
node_bot_runtime -->|"processes commands"| node_main_commands
node_discord_users -->|"invoke commands"| node_fun_cog
node_fun_cog -->|"fetches images"| node_safebooru
node_discord_users -->|"request audio"| node_media_tools
node_media_tools -->|"extracts audio"| node_youtube
node_discord_users -->|"send message"| node_mail_command
node_mail_command -->|"sends email"| node_email_service
node_web_monitor -.->|"checks endpoint"| node_keep_alive
node_bot_runtime -.->|"may start"| node_keep_alive

click node_bot_runtime "https://github.com/ahnti/cheesy/blob/master/main.py"
click node_ai_chat "https://github.com/ahnti/cheesy/blob/master/main.py"
click node_memory "https://github.com/ahnti/cheesy/blob/master/main.py"
click node_main_commands "https://github.com/ahnti/cheesy/blob/master/main.py"
click node_media_tools "https://github.com/ahnti/cheesy/blob/master/main.py"
click node_mail_command "https://github.com/ahnti/cheesy/blob/master/main.py"
click node_fun_cog "https://github.com/ahnti/cheesy/blob/master/cogs/fun.py"
click node_keep_alive "https://github.com/ahnti/cheesy/blob/master/keep_alive.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_runtime,node_discord_users toneBlue
class node_ai_chat,node_memory,node_main_commands,node_media_tools,node_mail_command,node_fun_cog toneAmber
class node_keep_alive,node_gemini,node_safebooru toneMint
class node_youtube,node_email_service,node_web_monitor toneIndigo
```

## Components

### Bot Runtime

- [Discord bot](https://github.com/ahnti/cheesy/blob/master/main.py): `main.py`

### Bot Features

- [AI chat](https://github.com/ahnti/cheesy/blob/master/main.py): `main.py`
- [Conversation memory](https://github.com/ahnti/cheesy/blob/master/main.py): `main.py`
- [Bot commands](https://github.com/ahnti/cheesy/blob/master/main.py): `main.py`
- [YouTube audio](https://github.com/ahnti/cheesy/blob/master/main.py): `main.py`
- [Email command](https://github.com/ahnti/cheesy/blob/master/main.py): `main.py`
- [Fun commands](https://github.com/ahnti/cheesy/blob/master/cogs/fun.py): `cogs/fun.py`

### Web Service

- [Keep-alive web server](https://github.com/ahnti/cheesy/blob/master/keep_alive.py): `keep_alive.py`

### Other components

- **Discord users**
- **Gemini API**
- **Safebooru API**
- **YouTube**
- **Email service**
- **Web monitor**

## Connections

- Discord users → Discord bot: send messages (evidence: `main.py`)
- Discord bot → AI chat: handles messages (evidence: `main.py`)
- AI chat → Conversation memory: builds context (evidence: `main.py`)
- AI chat → Gemini API: requests generation (evidence: `main.py`)
- Discord bot → Bot commands: processes commands (evidence: `main.py`)
- Discord users → Fun commands: invoke commands (evidence: `cogs/fun.py`)
- Fun commands → Safebooru API: fetches images (evidence: `cogs/fun.py`)
- Discord users → YouTube audio: request audio (evidence: `main.py`)
- YouTube audio → YouTube: extracts audio (evidence: `main.py`)
- Discord users → Email command: send message (evidence: `main.py`)
- Email command → Email service: sends email (evidence: `main.py`)
- Web monitor → Keep-alive web server: checks endpoint
- Discord bot → Keep-alive web server: may start (evidence: `main.py`)
