voiceStateUpdate stored per-server, some docs

This commit is contained in:
abalabahaha
2016-01-30 14:11:21 -08:00
parent 46807bf1c1
commit cd25848bdc
12 changed files with 134 additions and 95 deletions

View File

@@ -1710,22 +1710,7 @@ var InternalClient = (function () {
// in voice channel
var channel = self.channels.get("id", data.channel_id);
if (channel && channel.type === "voice") {
var oldState = {
mute: user.voiceState.mute,
self_mute: user.voiceState.self_mute,
deaf: user.voiceState.deaf,
self_deaf: user.voiceState.self_deaf
};
user.voiceState.mute = data.mute;
user.voiceState.self_mute = data.self_mute;
user.voiceState.deaf = data.deaf;
user.voiceState.self_deaf = data.self_deaf;
if ((oldState.mute != user.voiceState.mute || oldState.self_mute != user.voiceState.self_mute || oldState.deaf != user.voiceState.deaf || oldState.self_deaf != user.voiceState.self_deaf) && oldState.mute !== undefined) {
client.emit("voiceStateUpdate", channel, user, oldState);
} else {
server.eventVoiceJoin(user, channel);
client.emit("voiceJoin", channel, user);
}
server.eventVoiceStateUpdate(channel, user, data);
} else {
client.emit("warn", "voice state channel not in cache");
}