mirror of
https://github.com/danbulant/discord.js
synced 2026-06-18 22:21:17 +00:00
voiceSwitch, update user voiceChannel earlier
This commit is contained in:
parent
0128a88e25
commit
05def5b3f2
2 changed files with 12 additions and 6 deletions
|
|
@ -223,12 +223,15 @@ var Server = (function (_Equality) {
|
|||
Server.prototype.eventVoiceJoin = function eventVoiceJoin(user, channel) {
|
||||
// removes from other speaking channels first
|
||||
var oldChannel = this.eventVoiceLeave(user);
|
||||
if (oldChannel.id) {
|
||||
this.client.emit("voiceLeave", oldChannel, user);
|
||||
}
|
||||
|
||||
channel.members.add(user);
|
||||
user.voiceChannel = channel;
|
||||
|
||||
if (oldChannel.id) {
|
||||
this.client.emit("voiceLeave", oldChannel, user);
|
||||
this.client.emit("voiceSwitch", oldChannel, channel, user);
|
||||
}
|
||||
|
||||
this.client.emit("voiceJoin", channel, user);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -188,12 +188,15 @@ export default class Server extends Equality {
|
|||
eventVoiceJoin(user, channel) {
|
||||
// removes from other speaking channels first
|
||||
var oldChannel = this.eventVoiceLeave(user);
|
||||
if (oldChannel.id) {
|
||||
this.client.emit("voiceLeave", oldChannel, user);
|
||||
}
|
||||
|
||||
channel.members.add(user);
|
||||
user.voiceChannel = channel;
|
||||
|
||||
if (oldChannel.id) {
|
||||
this.client.emit("voiceLeave", oldChannel, user);
|
||||
this.client.emit("voiceSwitch", oldChannel, channel, user);
|
||||
}
|
||||
|
||||
this.client.emit("voiceJoin", channel, user);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue