fix(voice): resolve voice channel detection after bot reboot

- Move voice state population outside settings conditional in GuildCreate
  (now runs on every gateway resume, not just new guild joins)
- Make checkVoiceChannels() async with Fluxer API fallback
  (fetches member voice state directly when cache is empty after reboot)
- Fix PlayerManager client reference passing
- Update all callers to properly await checkVoiceChannels()
- Fix leave command to work without requiring user in voice channel

Fixes issue where bot couldn't detect users already in voice channels
immediately after a reboot due to empty voice state cache.
This commit is contained in:
NoLogicAlan committed 2026-04-16 23:41:25 +03:00
1 parent b1e9964a56
commit 73c290e59c
7 files changed
+180 -403

No files matched your search

+3 -3
View File
@@ -539,7 +539,7 @@ export default class Player extends EventEmitter {
}
if (res.statusCode !== 200 && res.statusCode !== 204) {
res.resume();
return reject(new Error(`HTTP ${res.statusCode} at ${target}`));
return reject(new Error(`HTTP ${res.statusCode} at NodeLink Server`));
}
if (returnStream) return resolve(res);
@@ -547,11 +547,11 @@ export default class Player extends EventEmitter {
res.on("data", d => chunks.push(d));
res.on("end", () => {
try { resolve(JSON.parse(Buffer.concat(chunks).toString())); }
catch (e) { reject(new Error(`JSON parse error from ${target}`)); }
catch (e) { reject(new Error(`JSON parse error from NodeLink Server`)); }
});
});
req.on("error", reject);
req.on("error", () => reject(new Error("Request error to NodeLink Server")));
req.setTimeout(options.timeout || 30_000, () => {
req.destroy();
reject(new Error("Request timeout"));