cleanup(Guild): remove Guild#voice (#5091)

This commit is contained in:
Jan
2020-12-12 14:49:32 +01:00
committed by GitHub
parent b509862bfa
commit bb04e69a92
4 changed files with 4 additions and 14 deletions

View File

@@ -37,7 +37,7 @@ class GuildDeleteAction extends Action {
}
for (const channel of guild.channels.cache.values()) this.client.channels.remove(channel.id);
if (guild.voice && guild.voice.connection) guild.voice.connection.disconnect();
guild.me?.voice.connection?.disconnect();
// Delete guild
client.guilds.cache.delete(guild.id);

View File

@@ -168,7 +168,7 @@ class VoiceConnection extends EventEmitter {
* @type {?VoiceState}
*/
get voice() {
return this.channel.guild.voice;
return this.channel.guild.me?.voice ?? null;
}
/**
@@ -182,8 +182,8 @@ class VoiceConnection extends EventEmitter {
{
guild_id: this.channel.guild.id,
channel_id: this.channel.id,
self_mute: this.voice ? this.voice.selfMute : false,
self_deaf: this.voice ? this.voice.selfDeaf : false,
self_mute: this.voice?.selfMute ?? false,
self_deaf: this.voice?.selfDeaf ?? false,
},
options,
);