# kemel49/prothombot1 architecture

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

- Interactive diagram: https://gitdiagram.com/kemel49/prothombot1
- Repository: https://github.com/kemel49/prothombot1

## Overview

Prothombot1 is a Telegram bot that turns an X/Twitter status URL into Wikipedia’s {{Cite tweet}} template. Its workflow polls Telegram updates, handles help commands or converts submitted URLs by parsing the status ID, fetching tweet text from the Twitter API, formatting the citation, and replying to the chat. The single source file contains the whole runtime; no persistence layer is shown. Edges reflect calls visible in main.py and API usage documented in the README.

Main entry points: [`main.py`](https://github.com/kemel49/prothombot1/blob/main/main.py) (Polling and routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_telegram["Telegram interaction"]
  node_main["Polling and routing<br/>[main.py]"]
  node_updates["Update retrieval<br/>[main.py]"]
  node_reply["Chat reply<br/>[main.py]"]
end

subgraph group_citation["Citation conversion"]
  node_url_parser["URL parsing<br/>[main.py]"]
  node_tweet_fetch["Tweet retrieval<br/>[main.py]"]
  node_template["Citation formatting<br/>[main.py]"]
end

node_user(("Telegram user"))
node_telegram_api{{"Telegram Bot API"}}
node_twitter_api{{"Twitter API"}}

node_user -->|"submits URL"| node_telegram_api
node_telegram_api -->|"delivers updates"| node_updates
node_main -->|"polls"| node_updates
node_main -->|"routes text"| node_url_parser
node_url_parser -->|"requests text"| node_tweet_fetch
node_tweet_fetch -->|"fetches tweet"| node_twitter_api
node_url_parser -->|"formats citation"| node_template
node_main -->|"sends result"| node_reply
node_reply -->|"posts message"| node_telegram_api
node_telegram_api -->|"delivers reply"| node_user

click node_main "https://github.com/kemel49/prothombot1/blob/main/main.py"
click node_updates "https://github.com/kemel49/prothombot1/blob/main/main.py"
click node_reply "https://github.com/kemel49/prothombot1/blob/main/main.py"
click node_url_parser "https://github.com/kemel49/prothombot1/blob/main/main.py"
click node_tweet_fetch "https://github.com/kemel49/prothombot1/blob/main/main.py"
click node_template "https://github.com/kemel49/prothombot1/blob/main/main.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_main,node_updates,node_reply,node_user toneBlue
class node_url_parser,node_tweet_fetch,node_template toneAmber
class node_telegram_api,node_twitter_api toneMint
```

## Components

### Telegram interaction

- [Polling and routing](https://github.com/kemel49/prothombot1/blob/main/main.py): `main.py`
- [Update retrieval](https://github.com/kemel49/prothombot1/blob/main/main.py): `main.py`
- [Chat reply](https://github.com/kemel49/prothombot1/blob/main/main.py): `main.py`

### Citation conversion

- [URL parsing](https://github.com/kemel49/prothombot1/blob/main/main.py): `main.py`
- [Tweet retrieval](https://github.com/kemel49/prothombot1/blob/main/main.py): `main.py`
- [Citation formatting](https://github.com/kemel49/prothombot1/blob/main/main.py): `main.py`

### Other components

- **Telegram user**
- **Telegram Bot API**
- **Twitter API**

## Connections

- Telegram user → Telegram Bot API: submits URL (evidence: `README.md`)
- Telegram Bot API → Update retrieval: delivers updates (evidence: `main.py`)
- Polling and routing → Update retrieval: polls (evidence: `main.py`)
- Polling and routing → URL parsing: routes text (evidence: `main.py`)
- URL parsing → Tweet retrieval: requests text (evidence: `main.py`)
- Tweet retrieval → Twitter API: fetches tweet (evidence: `main.py`)
- URL parsing → Citation formatting: formats citation (evidence: `main.py`)
- Polling and routing → Chat reply: sends result (evidence: `main.py`)
- Chat reply → Telegram Bot API: posts message (evidence: `main.py`)
- Telegram Bot API → Telegram user: delivers reply (evidence: `README.md`)
