Skip to content

Commit

Permalink
fix(GuildChannel): Fix manageable method for voice-channels (#6447)
Browse files Browse the repository at this point in the history
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
Co-authored-by: Kyra <kyranet@users.noreply.github.com>
Co-authored-by: ckohen <chaikohen@gmail.com>
  • Loading branch information
4 people committed Aug 29, 2021
1 parent 03d5549 commit 9301c9b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/structures/GuildChannel.js
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 9301c9b

Please sign in to comment.