# thegamer3514/silly-chat architecture

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

- Interactive diagram: https://gitdiagram.com/thegamer3514/silly-chat
- Repository: https://github.com/thegamer3514/silly-chat

## Overview

Silly Chat is a Discord global-chat bot. Discord users interact with the bot runtime, which handles chat and commands; one documented message path sends image URLs through the Giffy processor before the bot continues handling the result. The bot also exposes a web screenshot command backed by an external screenshot server and uses database collections. Giffy separates URL rules, scraping, downloading, and conversion. The main bot is a large monolith, so unsampled command and relay details are grouped there; database wiring beyond the shown collection access is not inferred.

Main entry points: [`main.py`](https://github.com/thegamer3514/silly-chat/blob/main/main.py) (Bot runtime), [`giffy/giffy.py`](https://github.com/thegamer3514/silly-chat/blob/main/giffy/giffy.py) (GIF processor), [`giffy/downloader.py`](https://github.com/thegamer3514/silly-chat/blob/main/giffy/downloader.py) (GIF downloader), [`giffy/data.py`](https://github.com/thegamer3514/silly-chat/blob/main/giffy/data.py) (Source rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Discord Bot"]
  node_runtime["Bot runtime<br/>[main.py]"]
  node_database[("Bot collections<br/>[main.py]")]
end

subgraph group_giffy["GIF Processing"]
  node_processor["GIF processor<br/>[giffy.py]"]
  node_rules["Source rules<br/>[data.py]"]
  node_scraper["Page scraper<br/>[scraper.py]"]
  node_downloader["GIF downloader<br/>[downloader.py]"]
  node_converter["Media converter<br/>[converter.py]"]
  node_tempfiles[("Temporary files")]
end

subgraph group_integrations["External Services"]
  node_discord{{"Discord platform"}}
  node_screenshot{{"Screenshot server"}}
  node_cdn{{"Silly Chat CDN"}}
  node_api{{"Silly Chat API"}}
end

node_users(("Discord users"))

node_users -->|"interact with"| node_runtime
node_runtime -->|"handles events"| node_discord
node_runtime -->|"processes image URL"| node_processor
node_processor -->|"reads rules"| node_rules
node_processor -->|"extracts page URL"| node_scraper
node_processor -->|"downloads media"| node_downloader
node_processor -->|"converts media"| node_converter
node_downloader -->|"writes files"| node_tempfiles
node_runtime -->|"queries collections"| node_database
node_runtime -->|"requests screenshots"| node_screenshot
node_runtime -->|"uploads media"| node_cdn
node_runtime -->|"checks image content"| node_api

click node_runtime "https://github.com/thegamer3514/silly-chat/blob/main/main.py"
click node_database "https://github.com/thegamer3514/silly-chat/blob/main/main.py"
click node_processor "https://github.com/thegamer3514/silly-chat/blob/main/giffy/giffy.py"
click node_rules "https://github.com/thegamer3514/silly-chat/blob/main/giffy/data.py"
click node_scraper "https://github.com/thegamer3514/silly-chat/blob/main/giffy/scraper.py"
click node_downloader "https://github.com/thegamer3514/silly-chat/blob/main/giffy/downloader.py"
click node_converter "https://github.com/thegamer3514/silly-chat/blob/main/giffy/converter.py"
click node_tempfiles "https://github.com/thegamer3514/silly-chat/tree/main/temp"

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_runtime,node_database,node_users toneBlue
class node_processor,node_rules,node_scraper,node_downloader,node_converter,node_tempfiles toneAmber
class node_discord,node_screenshot,node_cdn,node_api toneMint
```

## Components

### Discord Bot

- [Bot runtime](https://github.com/thegamer3514/silly-chat/blob/main/main.py): `main.py`
- [Bot collections](https://github.com/thegamer3514/silly-chat/blob/main/main.py): `main.py`

### GIF Processing

- [GIF processor](https://github.com/thegamer3514/silly-chat/blob/main/giffy/giffy.py): `giffy/giffy.py`
- [Source rules](https://github.com/thegamer3514/silly-chat/blob/main/giffy/data.py): `giffy/data.py`
- [Page scraper](https://github.com/thegamer3514/silly-chat/blob/main/giffy/scraper.py): `giffy/scraper.py`
- [GIF downloader](https://github.com/thegamer3514/silly-chat/blob/main/giffy/downloader.py): `giffy/downloader.py`
- [Media converter](https://github.com/thegamer3514/silly-chat/blob/main/giffy/converter.py): `giffy/converter.py`
- [Temporary files](https://github.com/thegamer3514/silly-chat/tree/main/temp): `temp`

### External Services

- **Discord platform**
- **Screenshot server**
- **Silly Chat CDN**
- **Silly Chat API**

### Other components

- **Discord users**

## Connections

- Discord users → Bot runtime: interact with (evidence: `README.md`)
- Bot runtime → Discord platform: handles events (evidence: `main.py`)
- Bot runtime → GIF processor: processes image URL (evidence: `main.py`)
- GIF processor → Source rules: reads rules (evidence: `giffy/giffy.py`)
- GIF processor → Page scraper: extracts page URL (evidence: `giffy/giffy.py`)
- GIF processor → GIF downloader: downloads media (evidence: `giffy/giffy.py`)
- GIF processor → Media converter: converts media (evidence: `giffy/giffy.py`)
- GIF downloader → Temporary files: writes files (evidence: `giffy/downloader.py`)
- Bot runtime → Bot collections: queries collections (evidence: `main.py`)
- Bot runtime → Screenshot server: requests screenshots (evidence: `main.py`)
- Bot runtime → Silly Chat CDN: uploads media (evidence: `main.py`)
- Bot runtime → Silly Chat API: checks image content (evidence: `main.py`)
