A Discord bot designed for full local and VPS server management — including network configuration, Docker control, system monitoring, and automated script execution. It integrates with FRP (Fast Reverse Proxy) and runs effortlessly via Docker or a .env file setup.
- Open and close TCP/UDP ports on local and VPS servers
- Reload iptables and manage firewall rules remotely
- Restart and manage FRP Docker containers
- View running or stopped Docker containers
- Display system usage, IP information, and latency
- Manage and run custom scripts
- Fully integrated Discord slash commands
- Python 3.11+ (only for manual installation)
- Docker installed on the host system
- VPS with SSH access and iptables configured
- A Discord bot token with application command permissions
Can be configured using a .env file or directly through Docker.
Example .env file:
token=YOUR_DISCORD_BOT_TOKEN
server_ip=YOUR_LOCAL_SERVER_IP
vps_ip=YOUR_VPS_IP_ADDRESS
vps_user=ubuntu
vps_key_path=/app/ssh_keys/id_rsa
vps_ports_custom=/etc/iptables/rules.v4
frpc_path=/app/frpc.toml
scripts_path=/DATA/AppData/DiscordBot/scripts
server_user=YOUR_LOCAL_SSH_USERNAME
server_key_path=/app/ssh_keys/local-server.key
SUDO_PASSWORD=YOUR_LOCAL_SUDO_PASSWORDThis bot runs seamlessly using the prebuilt image:
timmytheone/serverbot:latest
Below is a production-ready Docker Compose example (based on your current working configuration):
name: Discord_Management_Bot
services:
discord-bot:
image: timmytheone/serverbot:latest
container_name: discord-bot
hostname: discord-bot
restart: unless-stopped
environment:
- SUDO_PASSWORD=YOUR_SUDO_PASSWORD
- frpc_path=frpc.toml
- scripts_path=/DATA/AppData/DiscordBot/scripts
- server_ip=YOUR_LOCAL_SERVER_IP
- server_key_path=/app/ssh_keys/local-server.key
- server_user=YOUR_LOCAL_SSH_USERNAME
- sonarr_api_key=YOUR_SONARR_API_KEY
- token=YOUR_DISCORD_BOT_TOKEN
- vps_frpc_path=/home/ubuntu/frp.toml
- vps_ip=YOUR_VPS_IP
- vps_key_path=/app/ssh_keys/vps-private.key
- vps_ports_custom=/etc/iptables/rules.v4
- vps_user=ubuntu
volumes:
- /DATA/AppData/DiscordBot/ssh:/app/ssh_keys
- /DATA/AppData/frp/frpc.toml:/app/frpc.toml
- /var/run/docker.sock:/var/run/docker.sock
- /DATA/AppData/DiscordBot/config/.env:/.env
network_mode: bridge
Then run:
docker compose up -d-
Clone the repository:
git clone https://github.com/timmytheone/serverbot.git cd serverbot -
Install dependencies:
pip install -r requirements.txt
-
Set environment variables: Either in a
.envfile or directly in your shell environment. -
Run the bot:
python start.py
| Command | Description |
|---|---|
/help |
Show all available commands |
/info |
Display bot and server info |
/ping |
Check bot latency |
/ip |
Show server and VPS IPs |
/clearchat [limit] |
Clear chat messages |
/sync |
Force sync commands |
/setup |
Set up initial scripts |
| Command | Description |
|---|---|
/openport <name> <port> <type> |
Open a port on VPS and local |
/closeport <name> <port> <type> |
Close a port on VPS and local |
/refreshports |
Reload iptables and restart FRP |
/reload |
Reload VPS iptables |
/ports |
List open FRP ports |
| Command | Description |
|---|---|
/frprestart |
Restart FRP container |
/pruneimages |
Remove old Docker images |
/listcontainers |
List running and offline containers |
/stopcontainer <id> |
Stop a container |
/startcontainer <id> |
Start a container |
| Command | Description |
|---|---|
/system |
Show CPU, RAM, and temperature usage |
/run <command> |
Run a shell command on the server |
| Command | Description |
|---|---|
/scripts |
List available scripts |
/createscript <name> <content> |
Create a new script |
/deletescript <name> |
Delete a script |
/runscript <name> [sudo] |
Run a predefined script |
/refreshscripts |
Update script permissions |
/update |
Run the system update script |
/setup |
Create the default update.sh script |
Local Server: Manages FRP, Docker containers, and scripts directly.
VPS Management: Uses SSH (via Paramiko) to safely modify iptables and FRP configurations.
Discord Interface: Slash commands allow full control without direct terminal access.
| File | Purpose |
|---|---|
start.py |
Main Discord bot logic |
local.py |
Local FRP and Docker utilities |
vps.py |
Remote SSH and firewall utilities |
.env |
Optional environment configuration |
Dockerfile |
Defines Docker image |
requirements.txt |
Python dependencies |
MIT License This software is provided “as-is” without warranty of any kind. You are free to use, modify, and distribute it.