How qarabaierooom/qazaz-apk-boot works
Purpose and Entry Point
QazaQsha APK Store is an automated Telegram bot for publishing and distributing modded Android APKs. The entire application is a single Python process launched with python main.py; bot configuration, handlers, persistence, FSMs, and media generation are centralized in main.py.
Paths: main.py, README.md
Telegram Bot Runtime
The bot runs on Python 3.10+ with Aiogram 3.7+ and Telegram’s Bot API. It uses asynchronous command, message, callback-query, and document/media handlers. Primary public entry points are /start, including /start app_{id} download deep links, and /search; administrator entry points are /admin, /stats, and /send.
Paths: main.py
Persistence and Domain Model
SQLite is the durable system of record, created locally at runtime as apk_store.db. It stores applications and Telegram file_ids, users, download history, and dynamically managed mandatory-subscription channels. The bot includes schema initialization/migration behavior for older databases.
Core records connect the publishing and download lifecycle: an uploaded APK becomes an apps row; users are registered in users; approved downloads are recorded in downloads; gating channels come from mandatory_channels.
Paths: main.py
Admin APK Publishing Pipeline
Admin-only controls drive a seven-step in-memory FSM: APK document, icon, app name, description, version, mod features, and category/tags. The pipeline validates APK input, retains its Telegram file reference, computes SHA-256 for files up to 25 MB, derives a VirusTotal report URL, generates a branded preview, persists the app, and posts it to the configured Telegram channel with an HTML caption and deep-link download button.
FSM state is backed by Aiogram MemoryStorage, so in-progress submissions are lost on restart.
Paths: main.py, assets/logo.png, assets/badge.png
Media Generation Boundary
Pillow generates a 1920×1080 JPEG promotional preview from the submitted icon. Branding assets and a TrueType font are runtime dependencies: the icon is composed with the badge and logo, while app-name typography uses the font. This is local image processing; Telegram is responsible for storing and delivering the resulting media.
Paths: main.py, assets/logo.png, assets/badge.png, assets/font.ttf
User Download and Access Control Flow
A channel post’s deep link routes a user to /start app_{id}. Before returning the APK using the stored Telegram file_id, the bot checks membership in every mandatory channel through Telegram APIs. Non-members receive subscription links and a verification action; members receive the APK and create a download-history record. Search retrieves matching app records by name or description, and users can submit mod requests to administrators.
Paths: main.py
Operations, Broadcasts, and External Dependencies
Administrators can inspect aggregate statistics, manage mandatory channels, and broadcast text, photos, videos, or GIFs either to the publishing channel or all stored users. Bulk delivery is rate-limited with failure tracking. Required infrastructure is minimal: a long-running Python host, a writable local filesystem for SQLite/assets, Telegram bot credentials, a configured admin ID and channel ID, and network access to Telegram. VirusTotal is not called as an API; generated links point users to reports based on computed hashes.
Paths: main.py
Main entry points: main.py Command & Event Handlers
Components 16
Bot Runtime
- Bot Application · Single-process entry point containing handlers, domain logic, and initialization.
main.py - Command & Event Handlers · Handles commands, callbacks, documents, and media asynchronously.
main.py - SQLite Store · Locally initialized and migrated record store for apps, users, downloads, and channels.
- Admin Operations · Provides stats, channel management, and rate-limited broadcasts with failure tracking.
main.py
Admin Publishing
- Publishing FSM · Seven-step in-memory APK submission workflow; resets on restart.
main.py - APK Submission · Validates APKs and retains Telegram file references.
main.py - App Metadata · Collects icon, name, description, version, mod features, and tags.
main.py - Hash & Report Link · Hashes APKs up to 25 MB and derives a VirusTotal report URL.
main.py - Promotional Preview · Creates a branded 1920×1080 JPEG preview.
main.py - Branding Assets · Logo, badge, and font used by preview composition.
- Publishing Channel Post · Posts preview, HTML caption, and app deep-link button.
main.py
User Delivery
- App Deep Link · Routes channel visitors to the requested app download.
main.py - Subscription Gate · Checks every mandatory channel and presents subscription links when needed.
main.py - APK Delivery · Returns the stored APK file after access approval.
main.py - Search & Mod Requests · Searches app name/description and forwards mod requests to administrators.
main.py
Other components
- Telegram Bot API · Hosts bot interactions, files, channel posts, and membership checks.
Connections 23
- Telegram Bot API → Bot Application: updates and file access
- Bot Application → Command & Event Handlers: dispatches
- Command & Event Handlers → Publishing FSM: admin publishing flow
- Publishing FSM → APK Submission: collects
- Publishing FSM → App Metadata: collects
- APK Submission → Hash & Report Link: APK content
- App Metadata → Promotional Preview: icon and copy
- Branding Assets → Promotional Preview: logo, badge, font
- Hash & Report Link → SQLite Store: app hash and report URL
- Promotional Preview → Publishing Channel Post: rendered media
- SQLite Store → Publishing Channel Post: persisted app
- Publishing Channel Post → App Deep Link: download button
- App Deep Link → Subscription Gate: requested app
- Subscription Gate → Telegram Bot API: checks memberships
- SQLite Store → Subscription Gate: mandatory channels
- Subscription Gate → APK Delivery: approved member
- SQLite Store → APK Delivery: APK file_id; records download
- APK Delivery → Telegram Bot API: sends document
- Command & Event Handlers → Search & Mod Requests: user commands
- Search & Mod Requests → SQLite Store: queries apps and users
- Command & Event Handlers → Admin Operations: admin commands
- Admin Operations → SQLite Store: stats, users, channels
- Admin Operations → Telegram Bot API: broadcasts and channel updates