mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(GuildChannel): add manageable getter (#2439)
* Adds GuildChannel.manageable * Resolve requested changes * fix eslint max-len error * Fix for nullable permissionsFor() * Indent fixes
This commit is contained in:
@@ -380,6 +380,18 @@ class GuildChannel extends Channel {
|
||||
this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the channel is manageable by the client user
|
||||
* @type {boolean}
|
||||
* @readonly
|
||||
*/
|
||||
get manageable() {
|
||||
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]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the channel is muted
|
||||
* <warn>This is only available when using a user account.</warn>
|
||||
|
||||
Reference in New Issue
Block a user