also clear guild_id from voicestate on disconnect
This commit is contained in:
parent
fa19cd048c
commit
b826061e96
@ -54,6 +54,8 @@ export async function Close(this: WebSocket, code: number, reason: Buffer) {
|
|||||||
|
|
||||||
// @ts-expect-error channel_id is nullable
|
// @ts-expect-error channel_id is nullable
|
||||||
voiceState.channel_id = null;
|
voiceState.channel_id = null;
|
||||||
|
// @ts-expect-error guild_id is nullable
|
||||||
|
voiceState.guild_id = null;
|
||||||
voiceState.self_stream = false;
|
voiceState.self_stream = false;
|
||||||
voiceState.self_video = false;
|
voiceState.self_video = false;
|
||||||
await voiceState.save();
|
await voiceState.save();
|
||||||
@ -61,7 +63,10 @@ export async function Close(this: WebSocket, code: number, reason: Buffer) {
|
|||||||
// let the users in previous guild/channel know that user disconnected
|
// let the users in previous guild/channel know that user disconnected
|
||||||
await emitEvent({
|
await emitEvent({
|
||||||
event: "VOICE_STATE_UPDATE",
|
event: "VOICE_STATE_UPDATE",
|
||||||
data: voiceState.toPublicVoiceState(),
|
data: {
|
||||||
|
...voiceState.toPublicVoiceState(),
|
||||||
|
guild_id: prevGuildId, // have to send the previous guild_id because that's what client expects for disconnect messages
|
||||||
|
},
|
||||||
guild_id: prevGuildId,
|
guild_id: prevGuildId,
|
||||||
channel_id: prevChannelId,
|
channel_id: prevChannelId,
|
||||||
} as VoiceStateUpdateEvent);
|
} as VoiceStateUpdateEvent);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user