# kesav1503/natking-auto-uploader architecture

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

- Interactive diagram: https://gitdiagram.com/kesav1503/natking-auto-uploader
- Repository: https://github.com/kesav1503/natking-auto-uploader

## Overview

AppxAutoUploader is a Telegram bot for configuring course batches and automatically publishing their materials to group forums. The main flow is bot commands/callbacks into batch setup, ClassX content collection, scheduled or recovery processing, and Telegram uploads, with MongoDB tracking batches, topics, status, and duplicates. The graph reflects documented capabilities and source-index references; some modules are only partially excerpted or were not sampled, so uncertain runtime links are omitted.

Main entry points: [`master/database.py`](https://github.com/kesav1503/natking-auto-uploader/blob/main/master/database.py) (Batch and progress data), [`modules/appx_master.py`](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/appx_master.py) (Batch setup), [`modules/tasks.py`](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/tasks.py) (Batch processing), [`modules/appxdata.py`](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/appxdata.py) (Appx content extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Telegram bot"]
  node_commands["Bot commands<br/>[command.py]"]
  node_callbacks["Bot callbacks<br/>[callbacks.py]"]
  node_messages["Bot messages<br/>[msg.py]"]
  node_keyboards["Inline keyboards<br/>[buttom.py]"]
  node_application_start["Application startup<br/>[main.py]"]
end

subgraph group_content["Content collection"]
  node_batch_setup["Batch setup<br/>[appx_master.py]"]
  node_appx_extraction["Appx content extraction<br/>[appxdata.py]"]
  node_apnaex_extraction["ApnaEx extraction"]
end

subgraph group_processing["Scheduling and uploads"]
  node_scheduler["Update scheduler<br/>[scheduler.py]"]
  node_recovery["Recovery tasks<br/>[retasks.py]"]
  node_upload_tasks["Batch processing<br/>[tasks.py]"]
  node_forum_management["Forum management<br/>[manager.py]"]
end

subgraph group_state["Persistence and services"]
  node_database[("Batch and progress data<br/>[database.py]")]
  node_http_client["HTTP client<br/>[server.py]"]
  node_utilities["Content utilities<br/>[utils.py]"]
end

node_users(("Bot users"))
node_telegram["Telegram"]
node_classx["ClassX APIs"]
node_mongo[("MongoDB")]

node_users -->|"send commands"| node_commands
node_users -->|"select actions"| node_callbacks
node_commands -->|"use utilities"| node_utilities
node_callbacks -->|"invoke setup"| node_batch_setup
node_callbacks -->|"use keyboards"| node_keyboards
node_callbacks -->|"use messages"| node_messages
node_commands -->|"use messages"| node_messages
node_batch_setup -->|"save batch"| node_database
node_batch_setup -->|"collect content"| node_appx_extraction
node_batch_setup -->|"use extractor"| node_apnaex_extraction
node_batch_setup -->|"make API calls"| node_http_client
node_appx_extraction -->|"fetch content"| node_http_client
node_appx_extraction -->|"decrypt links"| node_utilities
node_application_start -->|"start scheduler"| node_scheduler
node_application_start -->|"start recovery"| node_recovery
node_scheduler -->|"load schedules"| node_database
node_scheduler -->|"collect content"| node_appx_extraction
node_scheduler -->|"process updates"| node_upload_tasks
node_recovery -->|"find incomplete batches"| node_database
node_recovery -->|"collect content"| node_appx_extraction
node_recovery -->|"resume uploads"| node_upload_tasks
node_upload_tasks -->|"track uploads"| node_database
node_upload_tasks -->|"manage topics"| node_forum_management
node_upload_tasks -->|"send materials"| node_telegram
node_forum_management -->|"create forum topics"| node_telegram
node_forum_management -->|"save topics"| node_database
node_database -->|"read and write"| node_mongo

click node_commands "https://github.com/kesav1503/natking-auto-uploader/blob/main/plugins/command.py"
click node_callbacks "https://github.com/kesav1503/natking-auto-uploader/blob/main/plugins/callbacks.py"
click node_messages "https://github.com/kesav1503/natking-auto-uploader/blob/main/constant/msg.py"
click node_keyboards "https://github.com/kesav1503/natking-auto-uploader/blob/main/constant/buttom.py"
click node_batch_setup "https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/appx_master.py"
click node_appx_extraction "https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/appxdata.py"
click node_apnaex_extraction "https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/apnaex_extractor.py"
click node_scheduler "https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/scheduler.py"
click node_recovery "https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/retasks.py"
click node_upload_tasks "https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/tasks.py"
click node_forum_management "https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/manager.py"
click node_database "https://github.com/kesav1503/natking-auto-uploader/blob/main/master/database.py"
click node_http_client "https://github.com/kesav1503/natking-auto-uploader/blob/main/master/server.py"
click node_utilities "https://github.com/kesav1503/natking-auto-uploader/blob/main/master/utils.py"
click node_application_start "https://github.com/kesav1503/natking-auto-uploader/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_commands,node_callbacks,node_messages,node_keyboards,node_application_start,node_users toneBlue
class node_batch_setup,node_appx_extraction,node_apnaex_extraction,node_mongo toneAmber
class node_scheduler,node_recovery,node_upload_tasks,node_forum_management,node_classx toneMint
class node_database,node_http_client,node_utilities toneRose
class node_telegram toneIndigo
```

## Components

### Telegram bot

- [Bot commands](https://github.com/kesav1503/natking-auto-uploader/blob/main/plugins/command.py): `plugins/command.py`
- [Bot callbacks](https://github.com/kesav1503/natking-auto-uploader/blob/main/plugins/callbacks.py): `plugins/callbacks.py`
- [Bot messages](https://github.com/kesav1503/natking-auto-uploader/blob/main/constant/msg.py): `constant/msg.py`
- [Inline keyboards](https://github.com/kesav1503/natking-auto-uploader/blob/main/constant/buttom.py): `constant/buttom.py`
- [Application startup](https://github.com/kesav1503/natking-auto-uploader/blob/main/main.py): `main.py`

### Content collection

- [Batch setup](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/appx_master.py): `modules/appx_master.py`
- [Appx content extraction](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/appxdata.py): `modules/appxdata.py`
- [ApnaEx extraction](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/apnaex_extractor.py): `modules/apnaex_extractor.py`

### Scheduling and uploads

- [Update scheduler](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/scheduler.py): `modules/scheduler.py`
- [Recovery tasks](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/retasks.py): `modules/retasks.py`
- [Batch processing](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/tasks.py): `modules/tasks.py`
- [Forum management](https://github.com/kesav1503/natking-auto-uploader/blob/main/modules/manager.py): `modules/manager.py`

### Persistence and services

- [Batch and progress data](https://github.com/kesav1503/natking-auto-uploader/blob/main/master/database.py): `master/database.py`
- [HTTP client](https://github.com/kesav1503/natking-auto-uploader/blob/main/master/server.py): `master/server.py`
- [Content utilities](https://github.com/kesav1503/natking-auto-uploader/blob/main/master/utils.py): `master/utils.py`

### Other components

- **Bot users**
- **Telegram**
- **ClassX APIs**
- **MongoDB**

## Connections

- Bot users → Bot commands: send commands (evidence: `plugins/command.py`)
- Bot users → Bot callbacks: select actions (evidence: `plugins/callbacks.py`)
- Bot commands → Content utilities: use utilities (evidence: `plugins/command.py`)
- Bot callbacks → Batch setup: invoke setup (evidence: `plugins/callbacks.py`)
- Bot callbacks → Inline keyboards: use keyboards (evidence: `plugins/callbacks.py`)
- Bot callbacks → Bot messages: use messages (evidence: `plugins/callbacks.py`)
- Bot commands → Bot messages: use messages (evidence: `plugins/command.py`)
- Batch setup → Batch and progress data: save batch (evidence: `modules/appx_master.py`)
- Batch setup → Appx content extraction: collect content (evidence: `modules/appx_master.py`)
- Batch setup → ApnaEx extraction: use extractor (evidence: `modules/appx_master.py`)
- Batch setup → HTTP client: make API calls (evidence: `modules/appx_master.py`)
- Appx content extraction → HTTP client: fetch content (evidence: `modules/appxdata.py`)
- Appx content extraction → Content utilities: decrypt links (evidence: `modules/appxdata.py`)
- Application startup → Update scheduler: start scheduler (evidence: `main.py`)
- Application startup → Recovery tasks: start recovery (evidence: `main.py`)
- Update scheduler → Batch and progress data: load schedules (evidence: `modules/scheduler.py`)
- Update scheduler → Appx content extraction: collect content (evidence: `modules/scheduler.py`)
- Update scheduler → Batch processing: process updates (evidence: `modules/scheduler.py`)
- Recovery tasks → Batch and progress data: find incomplete batches (evidence: `modules/retasks.py`)
- Recovery tasks → Appx content extraction: collect content (evidence: `modules/retasks.py`)
- Recovery tasks → Batch processing: resume uploads (evidence: `modules/retasks.py`)
- Batch processing → Batch and progress data: track uploads (evidence: `modules/tasks.py`)
- Batch processing → Forum management: manage topics (evidence: `modules/tasks.py`)
- Batch processing → Telegram: send materials (evidence: `modules/tasks.py`)
- Forum management → Telegram: create forum topics (evidence: `modules/manager.py`)
- Forum management → Batch and progress data: save topics (evidence: `modules/manager.py`)
- Batch and progress data → MongoDB: read and write (evidence: `master/database.py`)
