2021-08-19 14:19:14 +00:00
|
|
|
import { manager } from "../utils/soundplayer.js";
|
2021-03-05 18:06:22 +00:00
|
|
|
|
|
|
|
// run when a raw packet is sent, used for sending data to lavalink
|
2021-08-19 14:19:14 +00:00
|
|
|
export default async (client, cluster, worker, ipc, packet) => {
|
|
|
|
if (!manager) return;
|
2021-03-05 18:06:22 +00:00
|
|
|
switch (packet.t) {
|
|
|
|
case "VOICE_SERVER_UPDATE":
|
2021-08-19 14:19:14 +00:00
|
|
|
await manager.voiceServerUpdate(packet.d);
|
2021-03-05 18:06:22 +00:00
|
|
|
break;
|
|
|
|
case "VOICE_STATE_UPDATE":
|
2021-08-19 14:19:14 +00:00
|
|
|
await manager.voiceStateUpdate(packet.d);
|
2021-03-05 18:06:22 +00:00
|
|
|
break;
|
|
|
|
case "GUILD_CREATE":
|
2021-08-19 14:19:14 +00:00
|
|
|
for (const state of packet.d.voice_states) await manager.voiceStateUpdate({ ...state, guild_id: packet.d.id });
|
2021-03-05 18:06:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|