feat(voice): guarantee an empty generated channel disappears

A generated channel could survive with nobody in it: the row was dropped before
the channel was really gone, so a refused delete call left a room nothing could
track anymore, and an event missed while the bot was down was never retried.

The row is now kept until Discord confirms the channel is gone, and a sweep at
startup then every minute deletes whatever the event missed. The grace period
is tunable with VOICE_EMPTY_GRACE_MS, 0 deleting as soon as the room empties.
This commit is contained in:
BlackAngelTV committed 2026-09-15 16:11:30 +02:00
1 parent 836abeafd5
commit 76e2269555
5 files changed
+227 -36

No files matched your search

+2 -1
View File
@@ -1,7 +1,7 @@
import { ActivityType, Events } from 'discord.js';
import { createLogger } from '../core/logger.js';
import { startPollScheduler } from '../services/polls/poll-service.js';
import { sweepVoiceChannels } from '../services/voice/voice-service.js';
import { startVoiceJanitor, sweepVoiceChannels } from '../services/voice/voice-service.js';
const log = createLogger('discord');
@@ -12,6 +12,7 @@ export async function execute(client) {
client.user.setActivity('FWS Arch', { type: ActivityType.Watching });
startPollScheduler(client);
await sweepVoiceChannels(client);
startVoiceJanitor(client);
log.info(`Connected as ${client.user.tag}`, {
guilds: client.guilds.cache.size,
commands: client.commands.size,