mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
voiceSwitch, update user voiceChannel earlier
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user