fix(voice): restore voice after screen share — pass pre-release status to callbacks
The restore callback previously read getVoiceStatus() AFTER disconnectGuild had already cleared it, so it never knew which guild/channel to reconnect. Now release/restore receive the status captured BEFORE the audio connection is released, so reconnect actually happens after the GoLive stream ends.
This commit is contained in:
@@ -186,19 +186,18 @@ export class MediaHandler {
|
||||
this.getVoiceStatus,
|
||||
// releaseVoice — disconnect the @discordjs/voice connection so the
|
||||
// dank074 Streamer can take over (Discord: one voice session/user).
|
||||
async () => {
|
||||
async (status) => {
|
||||
const vc = this.voiceControllerAccessor?.();
|
||||
const guildId = vc?.getStatus().activeGuildId ?? null;
|
||||
const guildId = status.activeGuildId ?? null;
|
||||
if (vc && guildId) {
|
||||
await vc.disconnectGuild(guildId);
|
||||
}
|
||||
},
|
||||
// restoreVoice — reconnect the @discordjs audio connection after
|
||||
// the stream ends so mic/listen keep working.
|
||||
async () => {
|
||||
async (status) => {
|
||||
const vc = this.voiceControllerAccessor?.();
|
||||
const status = vc?.getStatus();
|
||||
if (vc && status?.activeGuildId && status.activeChannelId) {
|
||||
if (vc && status.activeGuildId && status.activeChannelId) {
|
||||
await vc.connect(status.activeGuildId, status.activeChannelId);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user