# marlico77/bot-telegram architecture

> Architecture diagram of the GitHub repository marlico77/bot-telegram, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marlico77/bot-telegram
- Repository: https://github.com/marlico77/bot-telegram

## Overview

MarlicoBot pairs an Android app/TV Box with a Windows agent to monitor and manage a home PC locally, while an optional Telegram bot relays commands when the Android device is away. The main flow is Android UI or Telegram command → Android client/service → paired Windows HTTP agent → metrics, inventory, screenshots, or confirmed power action. Update checks are a separate shared capability. Several Windows and Android details are documented but their implementation is in unsampled source, so those links cite the README rather than implying source inspection.

Main entry points: [`windows/src/br/com/marlico/agent/Agent.java`](https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java) (Agent service), [`android/src/br/com/marlico/bot/BotService.java`](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/BotService.java) (Bot service), [`shared/src/br/com/marlico/update/UpdateFeed.java`](https://github.com/marlico77/bot-telegram/blob/main/shared/src/br/com/marlico/update/UpdateFeed.java) (Update protocol), [`android/src/br/com/marlico/bot/MainActivity.java`](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/MainActivity.java) (WebView shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android client"]
  node_ui["Monitor panel<br/>[app.js]"]
  node_ui_shell["WebView shell<br/>[MainActivity.java]"]
  node_settings["Pairing settings<br/>[Config.java]"]
  node_lan_client["Agent API client<br/>[AgentApi.java]"]
  node_wol["Wake-on-LAN<br/>[Core.java]"]
end

subgraph group_telegram["Telegram relay"]
  node_bot_service["Bot service<br/>[BotService.java]"]
  node_conversation["Command routing<br/>[Conversation.java]"]
  node_telegram_api["Telegram API<br/>[TelegramApi.java]"]
end

subgraph group_windows["Windows agent"]
  node_agent["Agent service<br/>[Agent.java]"]
  node_live_metrics["Metrics and processes<br/>[Agent.java]"]
  node_inventory["Hardware inventory<br/>[Agent.java]"]
  node_screen["Screen access<br/>[Agent.java]"]
  node_power["Power controls<br/>[Agent.java]"]
  node_windows_panel["Agent panel<br/>[Agent.java]"]
end

subgraph group_updates["Update system"]
  node_update_android["Android updater<br/>[AppUpdates.java]"]
  node_update_windows["Windows updater<br/>[AppUpdates.java]"]
  node_update_feed["Update protocol<br/>[UpdateFeed.java]"]
end

node_android_user(("Android user"))
node_telegram_user(("Telegram user"))
node_update_catalog["Update catalog"]

node_android_user -->|"uses"| node_ui
node_ui_shell -->|"loads"| node_ui
node_ui_shell -->|"reads and saves"| node_settings
node_ui_shell -->|"requests PC"| node_lan_client
node_lan_client -->|"HTTP requests"| node_agent
node_telegram_user -->|"sends commands"| node_telegram_api
node_bot_service -->|"calls"| node_telegram_api
node_bot_service -->|"routes commands"| node_conversation
node_bot_service -->|"queries agent"| node_lan_client
node_bot_service -->|"sends wake packet"| node_wol
node_agent -->|"serves"| node_live_metrics
node_agent -->|"serves"| node_inventory
node_agent -->|"serves"| node_screen
node_agent -->|"executes confirmed action"| node_power
node_windows_panel -->|"displays and controls"| node_agent
node_ui -->|"checks updates"| node_update_android
node_update_android -->|"checks and downloads"| node_update_feed
node_update_windows -->|"checks and downloads"| node_update_feed
node_update_feed -->|"fetches manifest"| node_update_catalog
node_update_catalog -->|"returns release metadata"| node_update_feed

click node_ui "https://github.com/marlico77/bot-telegram/blob/main/android/assets/app.js"
click node_ui_shell "https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/MainActivity.java"
click node_settings "https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/Config.java"
click node_lan_client "https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/AgentApi.java"
click node_bot_service "https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/BotService.java"
click node_conversation "https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/Conversation.java"
click node_telegram_api "https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/TelegramApi.java"
click node_wol "https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/Core.java"
click node_agent "https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java"
click node_live_metrics "https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java"
click node_inventory "https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java"
click node_screen "https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java"
click node_power "https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java"
click node_windows_panel "https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java"
click node_update_android "https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/AppUpdates.java"
click node_update_windows "https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/AppUpdates.java"
click node_update_feed "https://github.com/marlico77/bot-telegram/blob/main/shared/src/br/com/marlico/update/UpdateFeed.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_ui_shell,node_settings,node_lan_client,node_wol,node_android_user,node_telegram_user toneBlue
class node_bot_service,node_conversation,node_telegram_api toneAmber
class node_agent,node_live_metrics,node_inventory,node_screen,node_power,node_windows_panel toneMint
class node_update_android,node_update_windows,node_update_feed toneRose
class node_update_catalog toneIndigo
```

## Components

### Android client

- [Monitor panel](https://github.com/marlico77/bot-telegram/blob/main/android/assets/app.js): `android/assets/app.js`
- [WebView shell](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/MainActivity.java): `android/src/br/com/marlico/bot/MainActivity.java`
- [Pairing settings](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/Config.java): `android/src/br/com/marlico/bot/Config.java`
- [Agent API client](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/AgentApi.java): `android/src/br/com/marlico/bot/AgentApi.java`
- [Wake-on-LAN](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/Core.java): `android/src/br/com/marlico/bot/Core.java`

### Telegram relay

- [Bot service](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/BotService.java): `android/src/br/com/marlico/bot/BotService.java`
- [Command routing](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/Conversation.java): `android/src/br/com/marlico/bot/Conversation.java`
- [Telegram API](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/TelegramApi.java): `android/src/br/com/marlico/bot/TelegramApi.java`

### Windows agent

- [Agent service](https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java): `windows/src/br/com/marlico/agent/Agent.java`
- [Metrics and processes](https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java): `windows/src/br/com/marlico/agent/Agent.java`
- [Hardware inventory](https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java): `windows/src/br/com/marlico/agent/Agent.java`
- [Screen access](https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java): `windows/src/br/com/marlico/agent/Agent.java`
- [Power controls](https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java): `windows/src/br/com/marlico/agent/Agent.java`
- [Agent panel](https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/Agent.java): `windows/src/br/com/marlico/agent/Agent.java`

### Update system

- [Android updater](https://github.com/marlico77/bot-telegram/blob/main/android/src/br/com/marlico/bot/AppUpdates.java): `android/src/br/com/marlico/bot/AppUpdates.java`
- [Windows updater](https://github.com/marlico77/bot-telegram/blob/main/windows/src/br/com/marlico/agent/AppUpdates.java): `windows/src/br/com/marlico/agent/AppUpdates.java`
- [Update protocol](https://github.com/marlico77/bot-telegram/blob/main/shared/src/br/com/marlico/update/UpdateFeed.java): `shared/src/br/com/marlico/update/UpdateFeed.java`

### Other components

- **Android user**
- **Telegram user**
- **Update catalog**

## Connections

- Android user → Monitor panel: uses (evidence: `README.md`)
- WebView shell → Monitor panel: loads (evidence: `android/src/br/com/marlico/bot/MainActivity.java`)
- WebView shell → Pairing settings: reads and saves (evidence: `android/src/br/com/marlico/bot/MainActivity.java`)
- WebView shell → Agent API client: requests PC (evidence: `android/src/br/com/marlico/bot/MainActivity.java`)
- Agent API client → Agent service: HTTP requests (evidence: `android/src/br/com/marlico/bot/AgentApi.java`)
- Telegram user → Telegram API: sends commands (evidence: `README.md`)
- Bot service → Telegram API: calls (evidence: `android/src/br/com/marlico/bot/BotService.java`)
- Bot service → Command routing: routes commands (evidence: `android/src/br/com/marlico/bot/BotService.java`)
- Bot service → Agent API client: queries agent (evidence: `android/src/br/com/marlico/bot/BotService.java`)
- Bot service → Wake-on-LAN: sends wake packet (evidence: `android/src/br/com/marlico/bot/BotService.java`)
- Agent service → Metrics and processes: serves (evidence: `README.md`)
- Agent service → Hardware inventory: serves (evidence: `windows/src/br/com/marlico/agent/Agent.java`)
- Agent service → Screen access: serves (evidence: `windows/src/br/com/marlico/agent/Agent.java`)
- Agent service → Power controls: executes confirmed action (evidence: `windows/src/br/com/marlico/agent/Agent.java`)
- Agent panel → Agent service: displays and controls (evidence: `README.md`)
- Monitor panel → Android updater: checks updates
- Android updater → Update protocol: checks and downloads (evidence: `android/src/br/com/marlico/bot/AppUpdates.java`)
- Windows updater → Update protocol: checks and downloads (evidence: `windows/src/br/com/marlico/agent/AppUpdates.java`)
- Update protocol → Update catalog: fetches manifest (evidence: `shared/src/br/com/marlico/update/UpdateFeed.java`)
- Update catalog → Update protocol: returns release metadata (evidence: `README.md`)
