How safaraliyev05/bot works
Main Components
• Telegram Bot Interface: Represented by the integration with the Telegram Bot API (using Aiogram).
• Core Application Logic: The Python application is launched from main.py and handles all bot commands (e.g., /start, /report, /users), lesson scheduling, and workflow logic.
• Data Management/Storage: The media directory contains the users.xlsx file, which is used to store user data and track engagement. This component is accessed via Pandas for data manipulation.
• Configuration: Although not a file in the tree, the usage of Dotenv indicates configuration through a .env file that holds the Telegram Bot token, admin chat IDs, and potentially other environment variables.
Relationships and Interactions
• When a user sends a command (like /start) in Telegram, the Telegram API receives it and forwards the message to the bot (using Aiogram).
• The bot’s event handlers in main.py process the request, triggering workflow logic to send the series of lesson videos, manage reminders, or log engagement data.
• For admin commands (like /report or /users), the bot interacts with the Pandas module to read/write to the users.xlsx file within the media folder, thereby generating reports.
• Environment-specific details (such as the Telegram Bot token or admin chat id) are loaded from the .env file through Dotenv, ensuring the application is configured properly.
Architectural Patterns and Design Principles
• Single-process, monolithic architecture: All logic is contained in main.py with file-based data storage.
• Event-driven design: Uses the Aiogram framework’s event-driven model to respond to commands and interactions received via Telegram.
• Separation of concerns (even in a small project): The application differentiates between user interactions (commands) and admin interactions, and separates data storage in a dedicated media directory.
• Use of external configuration management (via Dotenv) to safely handle sensitive tokens and IDs.
Technologies
• Python 3.8+: The language and runtime.
• Aiogram: Framework for Telegram bot interactions.
• Pandas: Library for handling and processing the data in the XLSX file.
• Dotenv: For managing environment variables.