No description
- Python 100%
| .env | ||
| .env.example | ||
| bot.py | ||
| bot.service | ||
| README.md | ||
| requirements.txt | ||
MSWT - ManageServerWithTG
Manage your server via Telegram bot.
Features
- System info: CPU, RAM, Disk, OS, Battery (
/info) - Shell terminal: Execute commands safely (
/sh) - Auto-start bots: Run
-start.sh/-start.batfiles (/bots) - Service restart: Trigger
restart_daemon.sh(/restart) - Server reboot (with confirmation) (
/stop)
Requirements
- Python 3.8+
- Linux (systemd for service)
- Dependencies in
requirements.txt
Installation
git clone <repo>
cd MSWT
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Configuration
Copy .env.example to .env and edit:
cp .env.example .env
nano .env
Required variables:
| Variable | Description | Example |
|---|---|---|
API_ID |
Telegram API ID (from my.telegram.org) | 2860432 |
API_HASH |
Telegram API Hash | 2fde6ca0f8ae7bb58844457a239c7214 |
OWNER_IDS |
Comma-separated Telegram user IDs with access | 1084116847,5466899247 |
VERSION |
Bot version string | 1.3.0 |
TELEGRAM_TOKEN |
Optional: Bot token. If set, uses bot account. If omitted, uses my_account.session file (user account). |
123456:ABC-DEF... |
Two auth modes:
- Bot token — set
TELEGRAM_TOKENin.env(recommended for production). - User session — leave
TELEGRAM_TOKENempty; bot readsmy_account.session(created after first login).
Run manually
python3 bot.py
Systemd service (Linux)
# Edit paths in bot.service
sudo cp bot.service /etc/systemd/system/mswt.service
sudo systemctl daemon-reload
sudo systemctl enable --now mswt
Commands
| Command | Description |
|---|---|
/start, /help |
Show help |
/info |
System stats |
/sh <cmd> |
Execute shell command |
/bots |
Start all *-start.sh/bat files in cwd |
/restart |
Run restart_daemon.sh |
/stop |
Reboot server (sudo) |
Security notes
/shblocks dangerous commands (rm -rf,reboot,shutdown,kill -9, etc.)- Only users in
OWNER_IDScan use the bot - Use bot token mode for production; avoid running as root
License
MIT