mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
errory voice
This commit is contained in:
@@ -192,6 +192,14 @@ class Guild {
|
||||
return base;
|
||||
}
|
||||
|
||||
_memberSpeakUpdate(user, speaking) {
|
||||
const member = this.members.get(user);
|
||||
if (member) {
|
||||
member.speaking = speaking;
|
||||
}
|
||||
this.client.emit(Constants.Events.GUILD_MEMBER_SPEAKING, member, speaking);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the Guild
|
||||
* @param {any} data
|
||||
@@ -288,12 +296,6 @@ class Guild {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed channel of the Guild.
|
||||
* @type {GuildChannel}
|
||||
*/
|
||||
this.embedChannel = this.channels.get(data.embed_channel_id);
|
||||
|
||||
if (data.roles) {
|
||||
this.roles.clear();
|
||||
for (const role of data.roles) {
|
||||
|
||||
@@ -64,6 +64,11 @@ class GuildMember {
|
||||
* @type {Date}
|
||||
*/
|
||||
this.joinDate = new Date(data.joined_at);
|
||||
/**
|
||||
* Whether this meember is speaking
|
||||
* @type {?Boolean}
|
||||
*/
|
||||
this.speaking = this.speaking;
|
||||
this._roles = data.roles;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,15 @@ class VoiceChannel extends GuildChannel {
|
||||
join() {
|
||||
return this.client.voice.joinChannel(this);
|
||||
}
|
||||
|
||||
leave() {
|
||||
const exists = this.client.voice.connections.get(this.guild.id);
|
||||
if (exists) {
|
||||
if (exists.channel.id === this.id) {
|
||||
exists.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = VoiceChannel;
|
||||
|
||||
Reference in New Issue
Block a user