How comerc/budva43 works
Based on examining the file tree and the README, it’s clear that this project is a Telegram message forwarding tool built with Go and tdlib. Its primary purpose is to listen for Telegram events (like new messages), apply configurable forwarding and filtering rules, and then send messages to specific chat destinations. It also supports inline keyboard interactions, markdown formatting, and has a containerized deployment approach.
Main Components
a. Entry Point & Core Application (main.go):
• Represents the application’s startup and overall orchestration.
b. Configuration & Environment Module:
• That the system loads environment variables (BUDVA32_API_ID, BUDVA32_API_HASH, etc.) and a YAML configuration that defines rules such as "Forwards", "Sources", "Reports", "ReplaceMyselfLinks", etc.
• This part of the architecture informs the forwarding behavior.
c. Telegram Client Integration (tdlib and go-tdlib):
• Message retrieval, sending, and link generation functions as outlined in the README code examples.
• How updates (using a channel-based listener) trigger message processing.
d. Forwarding Engine & Filtering Logic:
• Processing pipeline where messages are first received via the Telegram client.
• That for each incoming message, the system checks conditions (Include, Exclude, CopyOnce, Indelible, etc.) and then routes the message as per configured “Forwards.”
• Subcomponents (or modules) for filtering rules, markdown parsing, and inline keyboard creation.
e. Deployment Components & CI/CD:
Relationships and Interactions
• The application startup (main.go) first loads configuration.
• Once configured, it initializes the Telegram Client.
• The Telegram Client listens for new messages (via a channel or callback mechanism).
• The Forwarding Engine receives these messages, applying filtering and then invoking functions from the Telegram Client to either forward or send copies (potentially with modifications like markdown formatting or inline keyboard attachments).
• Data flows: from configuration to Telegram API communication to message processing and finally to message forwarding.
Architectural Patterns and Design Principles
• Modular separation: Even though the file tree is flat, the design logically separates configuration, Telegram client interactions, and forwarding rules.
• Event-driven architecture: Emphasize the update-listener mechanism where the system reacts to Telegram events.
• Use of external libraries: Clearly denote use of tdlib (through go-tdlib) and other libraries handling markdown processing, inline keyboard building, etc.
Relevant Technologies & Frameworks
• Go programming language, with dependency management via go.mod and go.sum.
• Docker for containerized deployment.
• tdlib and its Go bindings (go-tdlib) for Telegram API interactions.
• YAML configuration processing for dynamic forwarding/filtering rules.
• GitHub Actions / Dependabot (from the .github folder and dependabot.yml) for automation and dependency management.