Fix voice status persistence and global visibility across channels

This commit is contained in:
Jannis Braun
2026-02-19 17:37:30 +01:00
parent c7608e0655
commit a18e087e24
6 changed files with 38 additions and 10 deletions
+1 -2
View File
@@ -112,11 +112,9 @@ class ConnectionManager {
this.voiceStates.delete(channelId);
}
}
this.voiceUserStates.delete(userId);
}
leaveAllVoice(userId: string): string | null {
this.voiceUserStates.delete(userId);
for (const [channelId, users] of this.voiceStates) {
if (users.has(userId)) {
users.delete(userId);
@@ -560,6 +558,7 @@ export async function registerWebSocket(app: FastifyInstance): Promise<void> {
// Leave voice if in one
const leftChannel = connectionManager.leaveAllVoice(removedUserId);
connectionManager.clearVoiceUserStatus(removedUserId);
if (leftChannel) {
// Get channel's server to broadcast
const channel = db.select().from(schema.channels).where(eq(schema.channels.id, leftChannel)).get();