2021-03-05 18:06:22 +00:00
|
|
|
const player = require("../utils/soundplayer.js");
|
|
|
|
|
|
|
|
// run when a raw packet is sent, used for sending data to lavalink
|
2021-04-29 21:56:32 +00:00
|
|
|
module.exports = async (client, cluster, ipc, packet) => {
|
2021-03-05 21:13:54 +00:00
|
|
|
if (!player.manager) return;
|
2021-03-05 18:06:22 +00:00
|
|
|
switch (packet.t) {
|
|
|
|
case "VOICE_SERVER_UPDATE":
|
|
|
|
await player.manager.voiceServerUpdate(packet.d);
|
|
|
|
break;
|
|
|
|
case "VOICE_STATE_UPDATE":
|
|
|
|
await player.manager.voiceStateUpdate(packet.d);
|
|
|
|
break;
|
|
|
|
case "GUILD_CREATE":
|
|
|
|
for (const state of packet.d.voice_states) await player.manager.voiceStateUpdate({ ...state, guild_id: packet.d.id });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|