How veercli/veerv2 works
Project type and purpose
• This is a Telegram bot project written in Python.
• Its primary purpose is to handle incoming updates (commands, callbacks, inline queries, messages) and respond according to modular handler code.
• It relies on the Telegram Bot API, with optional forced-subscription to a channel.
File structure
• Top-level:
– bot.py: the main entry point that initializes the bot, registers handlers, and starts polling.
– setup.py, install.txt: installation and startup scripts.
• Directories:
– handlers/: each file is a handler module (all.py, callback.py, delete.py, edit.py, gpcmd.py, inline.py, locks.py, msg.py, nf.py, ranks.py, sudo.py).
– utlis/ (utils/typo): helper functions for locks, rank management, sending messages (send.py), and Telegram API wrappers (tg.py).
– lang/: language definitions and reply templates (arcmd.py, arreply.py).
• No external database code—state is managed in memory or simple lock files (locks.py).
Key points from README
• Guides install on Ubuntu 18 VPS; collects BOT_TOKEN, DEV_ID, CHANNEL_ID interactively.
• Requires granting the bot admin in a channel for forced subscription.
• Uses Python 3.8 and polling (no webhook specified).
Main components
a. Telegram API (cloud service)
b. Bot Process (your Python runtime)
– bot.py (core orchestrator)
– handlers/* (message-handling modules)
– utlis/* (utility library)
– lang/* (localization and reply templates)
c. Administrator (DEV_ID) – privileged user for owner commands
d. Channel (CHANNEL_ID) – for forced subscription
e. (Optional) Storage/Lock Files – for persistence of “locks” and “ranks” if implemented
Relationships and data flows
1. Telegram API sends an Update → Bot Process
2. bot.py inspects the Update and dispatches to the appropriate handler module
– e.g. a new message to handlers/msg.py, inline query to handlers/inline.py
3. Handler code may call utlis/send.py or utlis/tg.py to send messages back via the Telegram API
4. Handlers for locks or ranks consult utlis/locks.py or utlis/rank.py (and any backing storage)
6. For forced subscription, handler logic calls Telegram API to check user membership in CHANNEL_ID
Architectural patterns and design principles
• Modular handler registration – each concern in its own file
• Separation of concerns:
– Communication layer (tg.py)
– Business logic (handlers/)
– Utilities (locks, ranks, send wrappers)
– Localization (lang/)
• Single-process event loop (polling-based)