Clean up failed voice connections

This commit is contained in:
2026-06-22 12:18:35 +02:00
parent d10dae1b53
commit b29fda5ae9
2 changed files with 12 additions and 5 deletions
+8 -1
View File
@@ -89,7 +89,14 @@ export default class AudioManager {
});
this.connection.subscribe(this.audioPlayer);
await entersState(this.connection, VoiceConnectionStatus.Ready, this.options.connectTimeoutMs);
try {
await entersState(this.connection, VoiceConnectionStatus.Ready, this.options.connectTimeoutMs);
} catch (error) {
this.connection.destroy();
this.connection = undefined;
this.playbackState = 'stopped';
throw error;
}
this.playbackState = 'ready';
this.scheduleRenewal();
}