// Bot-Status (Presence) aus den Branding-Settings — hat Vorrang vor dem // Server-Monitor (der die Presence nur nutzt, wenn hier kein Text gesetzt ist). import { ActivityType, Events } from 'discord.js'; import { botStatusText, botStatusType, botPresenceStatus } from '../runtime-settings.js'; const TYPES = { playing: ActivityType.Playing, watching: ActivityType.Watching, listening: ActivityType.Listening, custom: ActivityType.Custom, }; /** Presence aus den Settings anwenden (Status immer, Aktivität nur wenn Text gesetzt) */ export function applyBotStatus(client) { const text = botStatusText(); try { client.user?.setPresence?.({ status: botPresenceStatus(), activities: text ? [{ name: text, type: TYPES[botStatusType()] ?? ActivityType.Custom }] : [], }); } catch (error) { console.error('[presence] Status setzen fehlgeschlagen:', error.message); } } export function registerPresence(client) { client.once(Events.ClientReady, () => applyBotStatus(client)); }