# miyurudilakshan/premium-content-sharing-telegram-bot architecture

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

- Interactive diagram: https://gitdiagram.com/miyurudilakshan/premium-content-sharing-telegram-bot
- Repository: https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot

## Overview

This is a single-file Telegram bot for distributing protected media through deep links. Admins upload media, configure protection and optional video previews, collages, or watermarks, then generate shareable links; users open links to access the media. The implementation excerpt confirms SQLite-backed media and user tables, parallel HTTP downloads, and media processing in bot.py. The README documents user-facing access, large-file support, administration, and Rekonise monetization, but their internal handlers are not shown, so those relationships are documented rather than source-verified.

Main entry points: [`bot.py`](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py) (Bot handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Admin Workflow"]
  node_bot["Bot handlers<br/>[bot.py]"]
  node_settings["Media settings<br/>[bot.py]"]
  node_admin_ops["Admin controls<br/>[bot.py]"]
end

subgraph group_media["Media Processing"]
  node_mediafiles["Uploaded media<br/>[bot.py]"]
  node_downloads["Parallel downloads<br/>[bot.py]"]
  node_mtproto["MTProto transfer<br/>[bot.py]"]
  node_preview["Video previews<br/>[bot.py]"]
  node_collage["Frame collages<br/>[bot.py]"]
  node_watermark["Video watermark<br/>[bot.py]"]
end

subgraph group_delivery["Link Delivery"]
  node_deep_link["Deep-link creation<br/>[bot.py]"]
  node_media_db[("Media database<br/>[bot.py]")]
  node_access["Protected access<br/>[bot.py]"]
end

subgraph group_monetization["Monetization"]
  node_monetize["Unlock rewards<br/>[bot.py]"]
  node_rekonise["Rekonise"]
end

node_admin(("Content Admin"))
node_enduser(("Link User"))
node_telegram["Telegram"]

node_admin -->|"sends media"| node_telegram
node_telegram -->|"delivers updates"| node_bot
node_bot -->|"configures"| node_settings
node_bot -->|"provides controls"| node_admin_ops
node_bot -->|"receives media"| node_mediafiles
node_bot -->|"downloads parts"| node_downloads
node_bot -->|"downloads large files"| node_mtproto
node_bot -->|"generates previews"| node_preview
node_bot -->|"generates collages"| node_collage
node_bot -->|"applies watermark"| node_watermark
node_bot -->|"creates links"| node_deep_link
node_bot -->|"stores media"| node_media_db
node_enduser -->|"opens link"| node_telegram
node_telegram -->|"requests media"| node_access
node_access -.->|"reads media"| node_media_db
node_bot -.->|"offers unlocks"| node_monetize
node_monetize -.->|"integrates rewards"| node_rekonise

click node_bot "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_settings "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_mediafiles "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_downloads "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_mtproto "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_preview "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_collage "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_watermark "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_deep_link "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_media_db "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_access "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_admin_ops "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py"
click node_monetize "https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.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_settings,node_admin_ops,node_enduser toneBlue
class node_mediafiles,node_downloads,node_mtproto,node_preview,node_collage,node_watermark toneAmber
class node_deep_link,node_media_db,node_access toneMint
class node_monetize,node_rekonise toneRose
class node_admin,node_telegram toneIndigo
```

## Components

### Admin Workflow

- [Bot handlers](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [Media settings](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [Admin controls](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`

### Media Processing

- [Uploaded media](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [Parallel downloads](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [MTProto transfer](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [Video previews](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [Frame collages](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [Video watermark](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`

### Link Delivery

- [Deep-link creation](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [Media database](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- [Protected access](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`

### Monetization

- [Unlock rewards](https://github.com/miyurudilakshan/premium-content-sharing-telegram-bot/blob/main/bot.py): `bot.py`
- **Rekonise**

### Other components

- **Content Admin**
- **Link User**
- **Telegram**

## Connections

- Content Admin → Telegram: sends media (evidence: `README.md`)
- Telegram → Bot handlers: delivers updates (evidence: `README.md`)
- Bot handlers → Media settings: configures (evidence: `bot.py`)
- Bot handlers → Admin controls: provides controls (evidence: `README.md`)
- Bot handlers → Uploaded media: receives media (evidence: `README.md`)
- Bot handlers → Parallel downloads: downloads parts (evidence: `bot.py`)
- Bot handlers → MTProto transfer: downloads large files (evidence: `bot.py`)
- Bot handlers → Video previews: generates previews (evidence: `README.md`)
- Bot handlers → Frame collages: generates collages (evidence: `README.md`)
- Bot handlers → Video watermark: applies watermark (evidence: `bot.py`)
- Bot handlers → Deep-link creation: creates links (evidence: `README.md`)
- Bot handlers → Media database: stores media (evidence: `bot.py`)
- Link User → Telegram: opens link (evidence: `README.md`)
- Telegram → Protected access: requests media (evidence: `README.md`)
- Protected access → Media database: reads media (evidence: `bot.py`)
- Bot handlers → Unlock rewards: offers unlocks (evidence: `README.md`)
- Unlock rewards → Rekonise: integrates rewards (evidence: `README.md`)
