summary refs log tree commit diff
diff options
context:
space:
mode:
authordank074 <torresefrain10@gmail.com>2026-02-27 19:37:44 -0600
committerRory& <root@rory.gay>2026-02-28 16:47:38 +0100
commit0784add134ac6c62fddf438da78fb9ec29763a9a (patch)
tree24312e9b0ab352d109ae7fd24842383522bc85a4
parentflake, move testvm to nixosconfigurations lkey (diff)
downloadserver-ts-0784add134ac6c62fddf438da78fb9ec29763a9a.tar.xz
onVoiceStateUpdate: change to VoiceState.merge() for copying properties
-rw-r--r--src/gateway/opcodes/VoiceStateUpdate.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gateway/opcodes/VoiceStateUpdate.ts b/src/gateway/opcodes/VoiceStateUpdate.ts

index e267461e..a128ee3e 100644 --- a/src/gateway/opcodes/VoiceStateUpdate.ts +++ b/src/gateway/opcodes/VoiceStateUpdate.ts
@@ -61,7 +61,7 @@ export async function onVoiceStateUpdate(this: WebSocket, data: Payload) { //The event send by Discord's client on channel leave has both guild_id and channel_id as null //if (body.guild_id === null) body.guild_id = voiceState.guild_id; prevState = { ...voiceState }; - voiceState.assign(body); + VoiceState.merge(voiceState, body); } catch (error) { voiceState = VoiceState.create({ ...body, @@ -70,6 +70,7 @@ export async function onVoiceStateUpdate(this: WebSocket, data: Payload) { mute: false, suppress: false, }); + isChanged = true; } // if user left voice channel, send an update to previous channel/guild to let other people know that the user left @@ -90,10 +91,14 @@ export async function onVoiceStateUpdate(this: WebSocket, data: Payload) { //TODO the member.user should only have these properties: avatar, discriminator, id, username //TODO this may fail if (body.guild_id) { - voiceState.member = await Member.findOneOrFail({ + const member = await Member.findOne({ where: { id: voiceState.user_id, guild_id: voiceState.guild_id }, relations: { user: true, roles: true }, }); + + if (member) { + voiceState.member = member; + } } //If the session changed we generate a new token