# jt921111/hertabot architecture

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

- Interactive diagram: https://gitdiagram.com/jt921111/hertabot
- Repository: https://github.com/jt921111/hertabot

## Overview

HertaBot is a small LINE messaging bot. LINE sends webhook events to Flask’s callback, which validates the signature and dispatches messages to the registered text handler. The handler replies through the LINE Messaging API for the “轉圈圈” command and gift-code messages, and has a 1-in-100 chance to send a video for other text. The handler also builds URLs for static media. The tree shows two video files; referenced PNG previews are not present. Only the sampled app.py supports the relationships shown.

Main entry points: [`app.py`](https://github.com/jt921111/hertabot/blob/main/app.py) (Text handler), [`static`](https://github.com/jt921111/hertabot/tree/main/static) (Static videos)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Bot runtime"]
  node_callback["Webhook callback<br/>[app.py]"]
  node_handler["Text handler<br/>[app.py]"]
  node_media["Static videos"]
end

node_line(("LINE platform"))
node_messaging["Messaging API"]

node_line -->|"posts webhook"| node_callback
node_callback -->|"dispatches events"| node_handler
node_handler -->|"sends replies"| node_messaging
node_handler -->|"links media"| node_media

click node_callback "https://github.com/jt921111/hertabot/blob/main/app.py"
click node_handler "https://github.com/jt921111/hertabot/blob/main/app.py"
click node_media "https://github.com/jt921111/hertabot/tree/main/static"

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_callback,node_handler,node_media toneBlue
class node_line toneIndigo
class node_messaging toneMint
```

## Components

### Bot runtime

- [Webhook callback](https://github.com/jt921111/hertabot/blob/main/app.py): `app.py`
- [Text handler](https://github.com/jt921111/hertabot/blob/main/app.py): `app.py`
- [Static videos](https://github.com/jt921111/hertabot/tree/main/static): `static`

### Other components

- **LINE platform**
- **Messaging API**

## Connections

- LINE platform → Webhook callback: posts webhook (evidence: `app.py`)
- Webhook callback → Text handler: dispatches events (evidence: `app.py`)
- Text handler → Messaging API: sends replies (evidence: `app.py`)
- Text handler → Static videos: links media (evidence: `app.py`)
