Dieses Repository enthält ein Node.js-Skript, das die Spieleranzahl mehrerer Server abfragt und die entsprechenden Discord-Channel-Namen automatisch aktualisiert. Das Skript nutzt dabei die Discord.js-Bibliothek sowie eine RCON-API.
- Node.js (empfohlen: Version 16 oder höher)
- Ein gültiger Discord-Bot-Token (DISCORD_TOKEN)
- Ein gültiger RCON-API-Token (API_TOKEN)
- Konfigurierte Umgebungsvariablen (.env-Datei)
- DISCORD_TOKEN
- API_TOKEN
- FLAG_YELLOW
- FLAG_GREEN
- UPDATE_INTERVAL_SECONDS (optional, Standardwert 300)
- Repository klonen oder herunterladen.
- Im Projektverzeichnis eine
.env-Datei erstellen und die erforderlichen Variablen eintragen (siehe oben). - Führe den Befehl
npm installaus, um die Abhängigkeiten zu installieren.
- Starte das Skript mit
node main.mjs. - Der Bot meldet sich bei Discord an und aktualisiert in regelmäßigen Abständen die Namen der angegebenen Discord-Kanäle basierend auf der Spieleranzahl.
- Die Spielserver-URLs, zugehörigen Discord-Kanäle und weitere Einstellungen findest du in
config.mjs. Passe sie an deine Bedürfnisse an.
- Das Skript verwendet Winston, um Log-Nachrichten in der Konsole auszugeben.
- Standardmäßig wird auf
debug-Ebene geloggt. Du kannst das bei Bedarf anpassen.
Dieses Projekt steht unter der MIT License. Du darfst es frei verwenden, verändern und verteilen.
This repository contains a Node.js script that queries multiple servers for their player count and automatically updates corresponding Discord channel names. It uses the Discord.js library and an RCON API.
- Node.js (recommended: version 16 or higher)
- A valid Discord Bot Token (DISCORD_TOKEN)
- A valid RCON API Token (API_TOKEN)
- Configured environment variables (.env file)
- DISCORD_TOKEN
- API_TOKEN
- FLAG_YELLOW
- FLAG_GREEN
- UPDATE_INTERVAL_SECONDS (optional, default 300)
- Clone or download this repository.
- Create a
.envfile in the project directory and set the required variables (see above). - Run
npm installto install dependencies.
- Start the script with
node main.mjs. - The bot will log in to Discord and periodically update the specified Discord channel names based on the player counts.
- You can find the server URLs, the corresponding Discord channels, and other settings in
config.mjs. Adjust them to your needs.
- This script uses Winston for console logging.
- It defaults to the
debuglevel. You can change this if needed.
This project is available under the MIT License. Feel free to use, modify, and distribute it.