How someoneex/naru_-final works
Project type and purpose
• This is a Python‐based Telegram bot (“Txt Extractor Bot”) whose sole purpose is to receive text files or APKs from users, scan them for URLs, and then log or relay those URLs. It is not a user‐facing web app but a backend microservice that runs continuously, reacts to Telegram events, and persists data to MongoDB.
File structure
• Top level
• Dockerfile, app.json, heroku.yml → containerization and Heroku deployment configs
• main.py → entrypoint, sets up Telegram client, dispatcher, and starts event loop
• config.py → environment variable loader for BOT_TOKEN, API_ID/HASH, DB credentials, channel IDs, etc.
• buttom.py, msg.py → utility modules for bot messages, UI text, maybe keyboard layouts
• database/appx_token.py → database wrapper to store/retrieve tokens or URLs in MongoDB
• module/
• ~40 files named by service/app + “free” suffix → each module implements URL‐extraction logic for a particular target (e.g., “khanfree” handles free URLs from Khan academy content).
• plugins/
• helper.py → shared utility functions, middleware or decorators for modular plug‐ins
• README.md describes deployment steps and required configuration
Key insights from README
• The bot uses Pyrogram or Telethon under the hood (implied by API_ID/HASH)
• Persists URL hits and other metadata in MongoDB (“DB_URL/DB_NAME”)
• Logs to 5 different Telegram channels (TXT_LOG, AUTH_LOG, etc.)
• Deployable to Heroku or Docker
Main components
a. Telegram Bot Service
– Entry point: main.py
– Load configuration (config.py)
– Telegram API client (Pyrogram/Telethon)
b. Module Manager
– module/ directory: individual URL‐extractor plugins
– plugins/helper.py: shared utilities
– msg.py & buttom.py: message templates, keyboards
c. Database Layer
– database/appx_token.py for token storage
– MongoDB Atlas or whatever DB_URL points to
d. Logging & Notification Channels
– Internal logging to: TXT_LOG, AUTH_LOG, HIT_LOG, DRM_DUMP channels
– Output back to users or designated Telegram channels
e. External Dependencies
– Telegram Bot API endpoints
– MongoDB server
– Heroku build/deploy environment or Docker container
Relationships & Data Flow
1) Incoming update from user → Telegram API → Bot Service
2) Bot Service passes raw input to Module Manager
3) Module Manager picks the correct extractor module based on user command or file type
4) Extractor module scans text/APK for URLs, returns list
5) Bot Service writes results to MongoDB via Database Layer
6) Bot Service pushes logs or results to appropriate Telegram channels
7) Bot Service replies back to user via Telegram API
Architectural patterns and principles
• Plugin architecture: each module independent, loaded dynamically
• Single responsibility: modules do extraction, database code is separate, config is externalized
• Event‐driven: responds to Telegram updates
• Infrastructure as code: Dockerfile, heroku.yml, app.json
Technologies & frameworks
• Python 3.x
• Pyrogram or Telethon (Telegram API client)
• PyMongo (MongoDB driver)
• Heroku / Docker for deployment
• Possibly APScheduler or asyncio for concurrency