mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
The beginnings of the voiceUserStateChange event
This commit is contained in:
@@ -153,7 +153,7 @@ var Server = (function (_Equality) {
|
||||
var _user = this.members.get("id", voiceState.user_id);
|
||||
var channel = this.channels.get("id", voiceState.channel_id);
|
||||
if (_user && channel) {
|
||||
this.eventStartSpeaking(_user, channel);
|
||||
this.eventVoiceJoin(_user, channel);
|
||||
} else {
|
||||
this.client.emit("warn", "user doesn't exist even though READY expects them to");
|
||||
}
|
||||
@@ -199,24 +199,15 @@ var Server = (function (_Equality) {
|
||||
return this.name;
|
||||
};
|
||||
|
||||
Server.prototype.eventStartSpeaking = function eventStartSpeaking(user, channel) {
|
||||
channel = this.channels.get("id", channel.id);
|
||||
if (channel && channel.type === "voice") {
|
||||
// good
|
||||
Server.prototype.eventVoiceJoin = function eventVoiceJoin(user, channel) {
|
||||
// removes from other speaking channels first
|
||||
this.eventVoiceLeave(user);
|
||||
|
||||
// removes from other speaking channels first
|
||||
this.eventStopSpeaking(user);
|
||||
|
||||
channel.members.add(user);
|
||||
user.voiceChannel = channel;
|
||||
return true;
|
||||
} else {
|
||||
// bad
|
||||
return false;
|
||||
}
|
||||
channel.members.add(user);
|
||||
user.voiceChannel = channel;
|
||||
};
|
||||
|
||||
Server.prototype.eventStopSpeaking = function eventStopSpeaking(user) {
|
||||
Server.prototype.eventVoiceLeave = function eventVoiceLeave(user) {
|
||||
for (var _iterator3 = this.channels.getAll("type", "voice"), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
|
||||
var _ref3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user