From 0387d34ab4900a0d2b936422f1b5609129d5528e Mon Sep 17 00:00:00 2001 From: Lewdcario Date: Mon, 4 Jun 2018 17:18:27 -0500 Subject: [PATCH] fix(VoiceChannel): deletable erroneously returning true --- src/structures/VoiceChannel.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/structures/VoiceChannel.js b/src/structures/VoiceChannel.js index fe7d7ddbc..a89dafa79 100644 --- a/src/structures/VoiceChannel.js +++ b/src/structures/VoiceChannel.js @@ -1,5 +1,6 @@ const GuildChannel = require('./GuildChannel'); const Collection = require('../util/Collection'); +const Permissions = require('../util/Permissions'); /** * Represents a guild voice channel on Discord. @@ -54,6 +55,15 @@ class VoiceChannel extends GuildChannel { return this.userLimit > 0 && this.members.size >= this.userLimit; } + /** + * Whether the channel is deletable by the client user + * @type {boolean} + * @readonly + */ + get deletable() { + return super.deletable && this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT); + } + /** * Checks if the client has permission join the voice channel * @type {boolean}