# Radio-Bot Discord-Radio- und YouTube-Bot mit Voice-Support für normale Voice-Channels. ## Voraussetzungen - Windows - Python 3.14.x - FFmpeg im Projekt unter: - `plugins/ffmpeg-8.0.1/bin/ffmpeg.exe` - Discord Bot Token in: - `bot_token.txt` - Bot-Avatare im Laufzeitordner: - `avatars/` ## Benötigte Python-Packages - `discord.py==2.7.1` - `davey==0.1.3` - `PyNaCl==1.6.2` - `yt-dlp` - `pyinstaller` ## Virtuelle Umgebung anlegen ```powershell py -3.14 -m venv .venv .\.venv\Scripts\Activate ``` ## Alle benötigten Packages installieren ```powershell python -m pip install -U pip setuptools wheel python -m pip install --only-binary=:all: "discord.py==2.7.1" "davey==0.1.3" "PyNaCl==1.6.2" "yt-dlp" "pyinstaller" ``` ## Projekt starten ```powershell python main.py ``` ## EXE Build Build immer aus dem aktivierten `.venv` ausführen. ```powershell python -m PyInstaller --noconfirm --clean --onedir --name Radio-Bot --hidden-import discord --hidden-import discord.ext.commands --hidden-import yt_dlp --collect-all discord --collect-all yt_dlp --collect-all nacl --collect-all davey --copy-metadata discord.py --copy-metadata yt-dlp --copy-metadata PyNaCl --copy-metadata davey --add-binary "D:\Git\Radio-Bot\plugins\ffmpeg-8.0.1\bin\ffmpeg.exe;plugins\ffmpeg-8.0.1\bin" --add-data "D:\Git\Radio-Bot\avatars;avatars" main.py ``` ## FFmpeg FFmpeg wird im Projekt im Plugin-Ordner erwartet: ```text plugins/ffmpeg-8.0.1/bin/ffmpeg.exe ``` Wenn eine andere FFmpeg-Version verwendet wird, muss der Pfad in `main.py` entsprechend angepasst werden. ## bot_token.txt Die Datei `bot_token.txt` wird benötigt und muss sich befinden: - beim normalen Python-Start im Projektordner - beim EXE-Build im selben Ordner wie die `Radio-Bot.exe` Beispiel: ```text dist/Radio-Bot/bot_token.txt ``` Inhalt der Datei: ```text DEIN_DISCORD_BOT_TOKEN ``` ## Dynamische Bot-Avatare Der Bot kann sein Avatarbild abhängig vom aktuellen Status automatisch wechseln. Status-Dateien im Ordner `avatars/`: - `idle.png` - `radio.png` - `youtube.png` oder `yt.png` - `leaving.png` - optional `default.png` oder `fallback.png` Unterstützte Formate: `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif` Wichtig: - Die Dateien werden direkt aus dem Laufzeitordner geladen. - Beim normalen Python-Start ist das der Projektordner. - Beim EXE-Build ist das der Ordner neben der `Radio-Bot.exe`. - Du kannst die Bilder später austauschen, ohne den Bot neu zu bauen. - Das neue Bild wird beim nächsten passenden Statuswechsel automatisch geladen. - Wenn ein Statusbild fehlt, versucht der Bot automatisch `idle` und danach `default` bzw. `fallback`. - Beim Start schreibt der Bot ins Log, welche Avatar-Dateien erkannt wurden. ## Wichtige Ordnerstruktur ```text Radio-Bot/ ├─ main.py ├─ bot_token.txt ├─ avatars/ │ ├─ idle.png │ ├─ radio.png │ ├─ youtube.png │ └─ leaving.png │ └─ default.png ├─ plugins/ │ └─ ffmpeg-8.0.1/ │ └─ bin/ │ └─ ffmpeg.exe └─ .venv/ ``` ## Verfügbare Commands - `!call` – Bot in deinen Voice-Channel holen - `!radio ` – Radio-Stream starten - `!bob` - Play Radio Bob Nation Live - `!yt ` – YouTube-Link starten oder in Queue einreihen - `!https://...` – YouTube-Link direkt ohne `!yt` einreihen - `!play` – pausierte Wiedergabe fortsetzen oder nächsten YT-Track starten - `!pause` – aktuelle Wiedergabe pausieren - `!stop` – Wiedergabe stoppen und Queue löschen - `!skip` – aktuellen YouTube-Track überspringen - `!leave` – Bot aus dem Voice-Channel entfernen - `!now` – aktuell laufenden Titel oder Stream anzeigen - `!list` – aktuelle Wiedergabe und Queue anzeigen - `!helpme` – Befehlsübersicht anzeigen ## Hinweise - Der Bot nutzt pro Server genau eine Audio-Instanz. - Für Voice-Funktionen müssen `PyNaCl` und `davey` korrekt installiert sein. - Beim EXE-Build hilft `debu.log.txt` beim Debugging, falls sich die EXE direkt wieder schließt.