mirror of
https://github.com/danbulant/discord.js
synced 2026-07-05 03:00:35 +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) {
|
Server.prototype.eventVoiceJoin = function eventVoiceJoin(user, channel) {
|
||||||
// removes from other speaking channels first
|
// removes from other speaking channels first
|
||||||
var oldChannel = this.eventVoiceLeave(user);
|
var oldChannel = this.eventVoiceLeave(user);
|
||||||
if (oldChannel.id) {
|
|
||||||
this.client.emit("voiceLeave", oldChannel, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
channel.members.add(user);
|
channel.members.add(user);
|
||||||
user.voiceChannel = channel;
|
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);
|
this.client.emit("voiceJoin", channel, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,12 +188,15 @@ export default class Server extends Equality {
|
||||||
eventVoiceJoin(user, channel) {
|
eventVoiceJoin(user, channel) {
|
||||||
// removes from other speaking channels first
|
// removes from other speaking channels first
|
||||||
var oldChannel = this.eventVoiceLeave(user);
|
var oldChannel = this.eventVoiceLeave(user);
|
||||||
if (oldChannel.id) {
|
|
||||||
this.client.emit("voiceLeave", oldChannel, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
channel.members.add(user);
|
channel.members.add(user);
|
||||||
user.voiceChannel = channel;
|
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);
|
this.client.emit("voiceJoin", channel, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue