Telegram Bot Control
Русский
Управление и мониторинг существующих Telegram-ботов на aiogram. Один владелец, один Windows/Linux-сервер, много ботов. Python SDK внутри бота, тёмная панель на русском/английском, отдельное desktop-приложение и необязательный веб-режим.
Установка
Python 3.11+. Venv не обязателен: используйте Python, которым бот уже запускается. Для существующего aiogram-проекта:
python -m pip install --upgrade telegram-bot-control
Если aiogram ещё не установлен: python -m pip install "telegram-bot-control[aiogram]".
Базовый пакет зависит только от psutil; веб-интерфейс и локальные шрифты с кириллицей
включены. Node.js/Electron для веб-режима не нужны. Приложение Windows и Linux AppImage:
GitHub Releases.
Подключение к существующему боту
После создания Bot и Dispatcher, до существующего polling/webhook startup:
from telegram_bot_control import start
monitor = start(bot=bot, dispatcher=dp, data_dir="/srv/bot-control/data",
capture_logs=True,
actions={"catalog:open": "catalog.open"})
dp.update.outer_middleware(monitor.middleware())
# В нужной точке кода после реальной операции:
monitor.track_action("order.completed")
На Windows пример папки: data_dir=r"C:\BotControl\data". У ботов и панели должна
быть одна абсолютная папка данных. Сохраните свои роутеры, .env, логгер и способ
запуска. SDK записывает локальные SQLite WAL-файлы без HTTP-сервера внутри бота.
Работаете с нейросетью? Готовый промпт для подключения к вашему проекту. Есть инструкции для обычного Python и venv; копирование доступно и в панели.
Веб-панель, в том числе для Linux/Termux:
tgbots web --host 127.0.0.1 --port 8765 --data-dir /srv/bot-control/data
В терминале появятся адрес и отдельный ключ доступа. Веб-режим и доступ с другого устройства.
Возможности 0.6.0
- Состояние ботов, пользователи, сообщения, команды, кнопки и история ошибок.
- Свои события
monitor.track_action()и декоратор@monitor.action()для функций: графики, точное время срабатывания, результат, длительность, фильтры и история. - Подключение существующих logging/Loguru, поиск и маскирование секретов.
- CPU, память RSS и потоки процесса каждого бота.
- Запуск/остановка/перезапуск, сложные команды и подготовительные шаги, ограниченный автоперезапуск.
- Настраиваемое хранение истории, русский/английский интерфейс, обучение и мастер подключения.
Документация событий · Подробный первый запуск · Репозиторий.
Ранняя версия для одного доверенного владельца. Если несколько ботов работают в одном Python-процессе, ресурсы у них общие и остановка затрагивает весь процесс. Автозагрузка как системная служба и импорт старых файлов логов пока не реализованы.
English
Monitoring and process control for existing aiogram bots. One owner, one Windows or Linux server, many bots. Includes an embedded Python SDK, an optional browser dashboard and a separately distributed desktop application.
Install
For an aiogram bot:
python -m pip install "telegram-bot-control[aiogram]"
For the lightweight web dashboard or stdio/SSH reader:
python -m pip install telegram-bot-control
Requires Python 3.11+. The base package depends only on psutil. The wheel includes the web UI and local Latin/Cyrillic fonts; Node.js and Electron are not required for browser mode. Windows setup and Linux AppImage are distributed through GitHub Releases.
Working with AI? Copy the integration prompt. Regular Python and existing venvs are supported.
Connect your bot
After creating your existing Bot and Dispatcher, add this inside your startup function, before polling:
from telegram_bot_control import start
monitor = start(
bot=bot,
dispatcher=dp,
data_dir="/srv/bot-control/data", # choose your own absolute directory
)
dp.update.outer_middleware(monitor.middleware())
await dp.start_polling(bot)
Use the same data directory for all connected bots and the dashboard. On Windows,
an example is data_dir=r"C:\BotControl\data". Keep your existing handlers,
routers, environment loader and polling call. The SDK writes bounded batches to
per-bot SQLite WAL files without opening a listening port in the bot.
Start the optional browser dashboard:
tgbots web --port 8765 --data-dir /srv/bot-control/data
The terminal displays a loopback URL and a separate dashboard access key. For network access and Termux, see the web dashboard guide. The default mode is local HTTP; use an HTTPS proxy or SSH tunnel for untrusted networks.
Features
- Custom events and sync/async function decorators, timelines, outcomes, duration and occurrence history.
- Bot status, message/command/button counters and retained error history.
- Existing Python logging and optional Loguru adapters, search and secret redaction.
- CPU, RSS and thread history for each bot's Python process.
- Explicit launch profiles: arguments, working directory, preparation steps and optional env-file.
- Start, graceful stop, restart and bounded on-failure automatic restarts.
- Detailed startup stderr/stdout, including failures before SDK initialization.
- Russian/English interfaces and configurable retention.
Optional integration with an already configured logger:
monitor.capture_logs() # standard logging; existing handlers are preserved
# For Loguru, use logger.add(monitor.loguru_sink, level="INFO") instead.
This is an early preview for a single trusted owner. Process control verifies PID, creation time and owner. Multiple bots sharing one Python process share resource measurements and cannot be stopped independently. It does not install an OS boot service or import historical log files.
Created by Дмитрий Варг. MIT license.
Metadata
Release files for telegram-bot-control 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| telegram_bot_control-0.6.0.tar.gz | 319.1 kB | With provenance | Details for telegram_bot_control-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| telegram_bot_control-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for telegram_bot_control-0.6.0-py3-none-any.whl |
Total release size: 563.6 kB
Release files / telegram_bot_control-0.6.0.tar.gz
| Download URL | telegram_bot_control-0.6.0.tar.gz |
|---|---|
| Size | 319.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28a61bd43031cacb584724693d4aa193cf9ea76d1fc625681b4661c9deac6a81
|
|
BLAKE2b-256 checksum How to use checksums |
ffeae64a70154fda2f111e1f6e511dd09a60bd7755a881c7f1b5cf8cae6266b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logRelease files / telegram_bot_control-0.6.0-py3-none-any.whl
| Download URL | telegram_bot_control-0.6.0-py3-none-any.whl |
|---|---|
| Size | 244.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f23270b228c8d1aba9b6553c3aeb9f1d7bd3fc300c622a475ceeac60220f6da
|
|
BLAKE2b-256 checksum How to use checksums |
1717cceef67e2a26010ca9339083bf3f83edd57ebe2029ed6dc38c016b91ccb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logSecurity for telegram-bot-control 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for telegram_bot_control-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.