Files
gotelegram_pro/gotelegram-bot
anten-ka 9d9d12e150 v2.4.8: preflight port-conflict check
Добавлена предустановочная проверка свободы портов перед установкой
telemt. На вход приходит режим (lite/pro) и выбранный порт, проверяются
443 (lite: выбранный), 80 и 8443 (pro). Известный proxy/VPN/веб-софт
(xray, sing-box, v2ray, trojan, hysteria, mtg, shadowsocks, x-ui,
marzban, amneziawg, caddy, apache, haproxy, wireguard, openvpn)
распознаётся по имени процесса и показывается отдельным блоком.

При конфликте пользователь видит список занятых портов, получает
рекомендацию удалить конфликтующий софт или взять чистый VPS, и
может либо форсировать установку, либо отказаться — тогда показывается
15-секундный промо-блок с QR для донатов и возврат в меню.

Override для автоматизированных сценариев: GOTELEGRAM_SKIP_PREFLIGHT=1.

Files:
  lib/common.sh      — get_port_process, match_known_conflict, preflight_check
  lib/lang/ru.sh     — preflight_* i18n keys (ru)
  lib/lang/en.sh     — preflight_* i18n keys (en)
  install.sh         — preflight_check вызов в install_lite_mode / install_pro_mode;
                        show_promo_with_qr теперь принимает countdown arg
  gotelegram-bot/bot.py — version bump 2.4.7 → 2.4.8
2026-04-11 23:48:53 +03:00
..
2026-04-11 23:48:53 +03:00

GoTelegram v2.2 Bot

Production-quality Telegram bot for managing MTProxy (telemt engine) on Linux servers.

Features

  • Complete CLI Feature Parity - All menu items from CLI version

    • Install (Quick/Stealth modes)
    • Status monitoring
    • Proxy link generation
    • Share with QR codes
    • Service restart
    • Logs viewing
    • Mode/template changes
    • Backup/restore
    • telemt updates
    • Website/SSL management
    • Remove installation
    • Promotional links
  • Template Browsing - Browse categories → templates → preview → install

  • V1 Migration - Detects old mtg Docker container and offers migration

  • Access Control - ALLOWED_IDS from .env

  • Async/Await - Full async support via python-telegram-bot v21+

  • Inline Keyboards - Modern UI with callback-based navigation

  • Shell Integration - Executes system commands via asyncio subprocess

  • Error Handling - Production-ready error handling

Installation

Prerequisites

  • Python 3.8+
  • Linux system with systemd
  • telemt installed and running
  • Telegram Bot Token from @BotFather

Setup

  1. Install dependencies:
pip install -r requirements.txt
  1. Create .env file:
cp config.example.env .env
# Edit .env and set your BOT_TOKEN
nano .env
  1. (Optional) Restrict access to specific users:
# Edit .env and uncomment ALLOWED_IDS
# ALLOWED_IDS=123456789,987654321

Running the Bot

python3 bot.py

For systemd service:

[Unit]
Description=GoTelegram Bot
After=network.target

[Service]
Type=simple
User=gotelegram
WorkingDirectory=/opt/gotelegram/bot
ExecStart=/usr/bin/python3 /opt/gotelegram/bot/bot.py
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Configuration

.env Variables

  • BOT_TOKEN - Telegram bot token (required)
  • ALLOWED_IDS - Comma-separated user IDs (optional, all users allowed if empty)

System Paths

  • GOTELEGRAM_CONFIG - /opt/gotelegram/config.json
  • TELEMT_CONFIG - /etc/telemt/config.toml
  • TELEMT_SERVICE - telemt (systemd service name)
  • WEBSITE_ROOT - /var/www/gotelegram-site
  • BACKUP_DIR - /opt/gotelegram/backups
  • TEMPLATES_CATALOG - /opt/gotelegram/templates_catalog.json

Architecture

Single File Design

All functionality in one bot.py for simplicity and ease of deployment.

Command Handlers

  • /start - Main menu
  • /help - Help text
  • /status - Quick status
  • /logs - Recent logs

Callback Handlers

Organized by feature:

  • Installation (quick/stealth modes)
  • Status monitoring
  • Backup/restore
  • SSL management
  • Updates
  • Removal

Shell Integration

Async subprocess wrapper:

code, stdout, stderr = await sh("command", "arg1", "arg2")

Callback Data Convention

  • menu_* - Menu items
  • install_mode_* - Install options
  • quick_dom_* - Domain selection
  • stealth_cat_* - Template categories
  • stealth_tpl_* - Template selection
  • stealth_confirm_* - Confirm installation
  • backup_* - Backup operations
  • ssl_* - SSL operations
  • restore_backup_* - Restore operations

Credits

  • telemt - MTProxy engine foundation
  • HTML5UP - Beautiful web templates
  • Learning Zone - Educational resources
  • Start Bootstrap - Bootstrap framework
  • Community - Your feedback and support

License

GoTelegram v2.2 - Open source community project