Skip to content
LemoniceITPublic

About

Lightweight, secure Windows 11 desktop app to monitor and remotely manage PC operations via a private Telegram Bot. Features encrypted credential storage (DPAPI) and strict Master-User access control.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

BotMyPC

License: MIT Python 3.14 Platform

Lightweight Windows desktop app for monitoring and controlling your PC through a private Telegram bot.

BotMyPC is not a remote shell. It uses a closed command registry: every message maps to a predefined handler. There is no path from Telegram to an arbitrary command line.

Security

Encrypted credentials. The bot token and master user ID are stored in Windows Credential Manager and mirrored to an encrypted fallback file. The fallback encryption key is protected by Windows DPAPI and bound to the signed-in account. The credential store does not write secrets in plain text; bot tokens are masked in logs.

Private access only. The bot accepts messages from private chats, and only from the configured master Telegram user ID. Messages from other users, groups, or channels are discarded before they are handled.

Closed command registry. The app does not use eval(), exec(), or an arbitrary shell. Each command is bound to a fixed handler. Extra arguments are rejected, except for note text and confirmations for panic, shutdown and restart.

Features

  • Dark interface. Built with CustomTkinter. The log view is updated in a thread-safe way, and the status indicator shows STOPPED, STARTING, RUNNING, STOPPING, or ERROR. A new bot worker cannot start while the previous worker is still stopping.
  • Tray and autostart. The window can minimize to the notification area. Optional startup is registered in the current user's Run key and does not require administrator rights.
  • Languages. English (default), Italian, German, Spanish, and French are built in and can be switched at runtime. To add another language, drop a translation JSON file into locales/.
  • Outlook monitor. Optional, and off by default. When enabled from the interface, it polls Microsoft Outlook through MAPI for subject keywords and sends a Telegram alert.
  • Guarded panic mode. /panic requires /panic confirm or /panic conferma within 15 seconds. It forcefully terminates processes with visible windows owned by the current user in the current Windows session. Unsaved work can be lost. Protected system processes and BotMyPC's process hierarchy are excluded; if the desktop cannot be identified, the operation is cancelled.

Commands

Commands are case-insensitive. A leading / is optional (/status and status are the same).

Command What it does
/status Reports CPU, memory, uptime, autostart state, and active monitors.
/ping Checks that the PC is online and responsive.
/help Lists the registered commands.
/out Locks the Windows session, equivalent to Win + L.
/firefox Starts Mozilla Firefox, if it is installed.
/outlook Starts Microsoft Outlook, if it is installed.
/shutdown Requests confirmation: send /shutdown confirm within 15 seconds to schedule shutdown in 10 seconds.
/restart Requests confirmation: send /restart confirm within 15 seconds to schedule a reboot in 10 seconds.
/annulla or /cancel Clears pending confirmations and cancels a scheduled shutdown or reboot.
/panic Closes non-essential user applications. Send /panic, then /panic confirm within 15 seconds. /panic conferma is also accepted.
note: <text> Saves the text to %LOCALAPPDATA%\BotMyPC\notes\ and opens it in Notepad. note <text> works as well.

Shutdown and restart also accept conferma. Unsaved work may be lost after confirmation. /status includes the actual bot lifecycle, the result of the last Telegram contact (not a continuous connectivity probe), and the Outlook worker state. Failed Outlook sends are retried on subsequent polling cycles; a network timeout can still produce a duplicate if Telegram accepted the message before the connection failed.

Repository layout

BotMyPc/
├── main.py                 # Entry point and shutdown handling
├── config.py               # Constants and UI palette
├── logging_config.py       # Log rotation and token masking
├── credentials.py          # Credential Manager and DPAPI storage
├── security.py             # Authorization, parsing, and panic confirmation
├── command_registry.py     # Closed command registry
├── telegram_bot.py         # Telegram polling loop
├── startup.py              # Per-user autostart
├── tray.py                 # Notification-area icon
├── gui.py                  # CustomTkinter interface
├── i18n.py                 # Built-in translations
├── icons.py                # Icon cache
├── outlook_monitor.py      # Optional Outlook watcher
├── commands/               # System, application, and panic handlers
├── locales/                # Template for additional languages
├── assets/                 # Interface icons
├── ico/                    # Application icon
├── tests/                  # Unit tests
├── botmypc.spec            # PyInstaller spec
├── build_exe.py            # Build script
├── requirements.txt        # Runtime dependencies
├── requirements-dev.txt    # Test dependencies
├── requirements-build.txt  # Packaging dependencies
├── constraints-win-py314.txt # Pinned Windows/Python 3.14 dependency graph
├── LICENSE
└── README.md

Requirements

  • Windows 10 or Windows 11 (64-bit)
  • Python 3.14 (64-bit) for the supplied dependency lock, only if you run from source
  • An internet connection so the bot can reach the Telegram API

Run from source

git clone https://github.com/LemoniceIT/BotMyPc.git
cd BotMyPc

python -m venv .venv
.\.venv\Scripts\Activate.ps1

pip install -r requirements.txt
python main.py

On first launch, set the bot token from @BotFather and your positive numeric user ID from @userinfobot, then start the bot. The log confirms token verification with Telegram. Open your bot, press Start and send /ping: a PONG response verifies that the configured ID matches your account. If access is denied, check the master ID; if startup fails, check the token and network connection.

requirements.txt contains runtime dependencies only. constraints-win-py314.txt pins the dependency graph captured on Windows x64 / Python 3.14. Development and build tools are separate. Other Python versions require a separately resolved and verified lock.

Standalone executable

Build on Windows, from the project directory, after installing the requirements:

pip install -r requirements-build.txt
python build_exe.py

PyInstaller writes dist/BotMyPC.exe.

Published binaries, when available, are on the Releases page.

The published v1.0.0 executable predates the reliability changes described here. Build from the current source to include them until a newer release is published.

Local data and privacy

Settings, encrypted fallback credentials, rotating logs and notes are stored under %LOCALAPPDATA%\BotMyPC\. Logs can contain command text, note previews, Telegram sender identifiers and matching email subjects. Review logs before sharing them.

Credential files, local settings, logs, notes, virtual environments and build outputs are excluded from Git. Tokens and identifiers in examples and unit tests are synthetic. Never commit your actual bot token or personal configuration.

Tests

pip install -r requirements-dev.txt
python -m pytest -v

pytest is included in requirements-dev.txt.

Screenshots

Main Dashboard

Log Viewer

Outlook Monitor

Language Selector

System Tray

License

Released under the MIT License.

About

Lightweight, secure Windows 11 desktop app to monitor and remotely manage PC operations via a private Telegram Bot. Features encrypted credential storage (DPAPI) and strict Master-User access control.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages