import { Events } from 'discord.js'; import { createLogger } from '../core/logger.js'; import { startPollScheduler } from '../services/polls/poll-service.js'; import { startBotStatusRotation } from '../services/status/bot-status-service.js'; import { adoptOrphanVoiceChannels, startVoiceJanitor, sweepVoiceChannels, } from '../services/voice/voice-service.js'; const log = createLogger('discord'); export const name = Events.ClientReady; export const once = true; export async function execute(client) { startPollScheduler(client); // Channels outlive the process: take back the ones the database forgot before // the sweep decides they are not ours. await adoptOrphanVoiceChannels(client).catch((error) => log.warn('Could not recover the orphan voice channels', error), ); await sweepVoiceChannels(client); startVoiceJanitor(client); startBotStatusRotation(client); log.info(`Connected as ${client.user.tag}`, { guilds: client.guilds.cache.size, commands: client.commands.size, }); }