mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
voice: rewrite GuildMember#speaking tracking (#2540)
This commit is contained in:
@@ -56,14 +56,19 @@ class GuildMember extends Base {
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* Whether this member is speaking and the client is in the same channel
|
||||
* @type {boolean}
|
||||
* @name GuildMember#speaking
|
||||
*/
|
||||
if (typeof this.speaking === 'undefined') this.speaking = false;
|
||||
/**
|
||||
* Whether this member is speaking. If the client isn't sure, then this will be undefined. Otherwise it will be
|
||||
* true/false
|
||||
* @type {?boolean}
|
||||
* @name GuildMember#speaking
|
||||
*/
|
||||
get speaking() {
|
||||
return this.voiceChannel && this.voiceChannel.connection ?
|
||||
Boolean(this.voiceChannel.connection._speaking.get(this.id)) :
|
||||
undefined;
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
/**
|
||||
* The nickname of this member, if they have one
|
||||
* @type {?string}
|
||||
|
||||
Reference in New Issue
Block a user