mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
Added websocket voice state watching
Now emits voiceJoin(user, voice_channel) or voiceLeave(user, voice_channel) and adds/removes from voice_channel.speaking when a user joins or leaves a voice channel.
This commit is contained in:
@@ -129,6 +129,32 @@ export default class Server extends Equality {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
eventStartSpeaking(user, channel){
|
||||
channel = this.channels.get("id", channel.id);
|
||||
if(channel){
|
||||
// good
|
||||
|
||||
// removes from other speaking channels first
|
||||
this.eventStopSpeaking(user);
|
||||
|
||||
channel.speaking.add(user);
|
||||
return true;
|
||||
}else{
|
||||
// bad
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
eventStopSpeaking(user){
|
||||
for(let chan of this.channels.getAll("type", "voice")){
|
||||
if(chan.speaking.has(user)){
|
||||
chan.speaking.remove(user);
|
||||
return chan;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
equalsStrict(obj) {
|
||||
if (obj instanceof Server) {
|
||||
for (var key of strictKeys) {
|
||||
|
||||
Reference in New Issue
Block a user