Initiales Setup: minimaler Discord-Bot mit /ping, Docker-Deployment und README
- discord.js v14 Bot mit Slash-Command-Registry (Guild oder global) - Konfiguration über .env mit Validierung (config.js) - Dockerfile + docker-compose.yml für Portainer-Deployment - README mit Schritt-für-Schritt-Anleitung (Discord Developer Portal) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// Zentrale Konfiguration — liest alle Werte aus der Umgebung (.env lokal, env_file im Container)
|
||||
import 'dotenv/config';
|
||||
|
||||
/** Pflicht-Variable lesen, bei Fehlen sofort mit klarer Meldung abbrechen */
|
||||
function required(name) {
|
||||
const value = process.env[name];
|
||||
if (!value) {
|
||||
console.error(`[config] Fehlende Umgebungsvariable: ${name} — siehe .env.example`);
|
||||
process.exit(1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
export const config = {
|
||||
// Discord Bot
|
||||
discordToken: required('DISCORD_TOKEN'),
|
||||
discordClientId: required('DISCORD_CLIENT_ID'),
|
||||
// Optional: Guild-ID für sofortige Slash-Command-Registrierung (global dauert bis zu 1h)
|
||||
discordGuildId: process.env.DISCORD_GUILD_ID || null,
|
||||
};
|
||||
Reference in New Issue
Block a user