From 9301c9b42085e860f49a322879b21b923e23a4d7 Mon Sep 17 00:00:00 2001 From: DraftMan Date: Sun, 29 Aug 2021 17:26:05 +0200 Subject: [PATCH] fix(GuildChannel): Fix manageable method for voice-channels (#6447) Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Kyra Co-authored-by: ckohen --- src/structures/GuildChannel.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index b706ffa39..14f45b26d 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -511,14 +511,12 @@ class GuildChannel extends Channel { */ get manageable() { if (this.client.user.id === this.guild.ownerId) return true; - if (VoiceBasedChannelTypes.includes(this.type)) { - if (!this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false)) { - return false; - } - } else if (!this.viewable) { - return false; - } - return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false); + const permissions = this.permissionsFor(this.client.user); + if (!permissions) return false; + const bitfield = VoiceBasedChannelTypes.includes(this.type) + ? Permissions.FLAGS.MANAGE_CHANNELS | Permissions.FLAGS.CONNECT + : Permissions.FLAGS.VIEW_CHANNEL | Permissions.FLAGS.MANAGE_CHANNELS; + return permissions.has(bitfield, false); } /**