summary refs log tree commit diff
path: root/src/opcodes
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-31 20:32:03 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-31 20:32:03 +0200
commit5856047e3d518f10fc65d3a850567ea0719d236b (patch)
tree9ca76ec40777d2520abe252a4f6a686b7f5393d2 /src/opcodes
parent:art: create start.ts (diff)
downloadserver-5856047e3d518f10fc65d3a850567ea0719d236b.tar.xz
:sparkles: start.ts file
Diffstat (limited to 'src/opcodes')
-rw-r--r--src/opcodes/VoiceStateUpdate.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/opcodes/VoiceStateUpdate.ts b/src/opcodes/VoiceStateUpdate.ts

index f2230cd9..0d51513d 100644 --- a/src/opcodes/VoiceStateUpdate.ts +++ b/src/opcodes/VoiceStateUpdate.ts
@@ -1,5 +1,6 @@ import { VoiceStateUpdateSchema } from "../schema/VoiceStateUpdate.ts"; import { CLOSECODES, Payload } from "../util/Constants"; +import { Send } from "../util/Send"; import WebSocket from "../util/WebSocket"; import { check } from "./instanceOf"; @@ -8,6 +9,18 @@ import { check } from "./instanceOf"; // TODO: save voice servers in database and retrieve them // Notice: Bot users respect the voice channel's user limit, if set. When the voice channel is full, you will not receive the Voice State Update or Voice Server Update events in response to your own Voice State Update. Having MANAGE_CHANNELS permission bypasses this limit and allows you to join regardless of the channel being full or not. -export function onVoiceStateUpdate(this: WebSocket, data: Payload) { +export async function onVoiceStateUpdate(this: WebSocket, data: Payload) { check.call(this, VoiceStateUpdateSchema, data.d); + const body = data.d as VoiceStateUpdateSchema; + + await Send(this, { + op: 0, + s: this.sequence++, + t: "VOICE_SERVER_UPDATE", + d: { + token: ``, + guild_id: body.guild_id, + endpoint: `localhost:3004`, + }, + }); }