mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
fix: ensure VIEW_CHANNEL permissions before trying to join (#3046)
* fix: ensure VIEW_CHANNEL permissions before joining * nit(GuildChannel): remove the redundant truthy check
This commit is contained in:
@@ -523,10 +523,21 @@ class GuildChannel extends Channel {
|
||||
* @readonly
|
||||
*/
|
||||
get manageable() {
|
||||
if (this.client.user.id === this.guild.ownerID) return true;
|
||||
if (!this.viewable) return false;
|
||||
return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the channel is viewable by the client user
|
||||
* @type {boolean}
|
||||
* @readonly
|
||||
*/
|
||||
get viewable() {
|
||||
if (this.client.user.id === this.guild.ownerID) return true;
|
||||
const permissions = this.permissionsFor(this.client.user);
|
||||
if (!permissions) return false;
|
||||
return permissions.has([Permissions.FLAGS.MANAGE_CHANNELS, Permissions.FLAGS.VIEW_CHANNEL], false);
|
||||
return permissions.has(Permissions.FLAGS.VIEW_CHANNEL, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user