#!/usr/bin/env bash set -euo pipefail # Ensure the script works regardless of the current working directory. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" echo "Starte Discord Bot..." if [[ ! -f ".env" ]]; then echo "Hinweis: .env wurde nicht gefunden. Der Bot startet nur, wenn die benoetigten Variablen bereits als Umgebungsvariablen gesetzt sind." fi PYTHON_BIN=".venv/bin/python" if [[ ! -x "$PYTHON_BIN" ]]; then if command -v python3 >/dev/null 2>&1; then PYTHON_BIN="$(command -v python3)" echo "Hinweis: .venv/bin/python nicht gefunden, nutze $PYTHON_BIN." else echo "Fehler: Kein Python-Interpreter gefunden. Lege zuerst ein venv an oder installiere python3." exit 1 fi fi exec "$PYTHON_BIN" "$SCRIPT_DIR/discord_bot.py"