Skip to main content

Installation

🚀 Installation​

Requirements​

  • Python 3.9+
  • pip
  • Optional: mysqldump for /backup_database

1. Create directory and copy files​

sudo mkdir -p /opt/discord_multibot
sudo chown $USER:$USER /opt/discord_multibot
cd /opt/discord_multibot
# Copy all project files here

2. Virtual environment & dependencies​

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

3. Configure environment variables​

cp .env.example .env
nano .env # Fill in your tokens and IDs

Note: Each bot requires its own bot application in the Discord Developer Portal. Bots without a token are automatically skipped on startup.

4. Manual test run​

source venv/bin/activate
python main.py

systemd-Service​

# Create a dedicated system user (recommended — never run as root)
sudo useradd --system --no-create-home --shell /sbin/nologin discord

# Set permissions
sudo chown -R discord:discord /opt/discord_multibot

Install & enable the service​

sudo cp multibot.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now multibot.service

Nützliche Befehle​

# Show status
sudo systemctl status multibot.service

# Live logs (journald)
sudo journalctl -u multibot.service -f

# File log
tail -f /opt/discord_multibot/multibot.log

# Restart (e.g. after .env changes)
sudo systemctl restart multibot.service

# Stop
sudo systemctl stop multibot.service

# Disable autostart
sudo systemctl disable multibot.service

Security Notes​

  • Never commit .env — it is listed in .gitignore
  • /backup_database uses os.system — only use on trusted servers
  • The systemd service runs under a restricted discord user with no root privileges
  • Permission changes on roles are highlighted in red in the log channel