mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +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:
@@ -539,6 +539,17 @@ class GuildChannel extends Channel {
|
|||||||
return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS);
|
return 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);
|
||||||
|
return permissions && permissions.has([Permissions.FLAGS.MANAGE_CHANNELS, Permissions.FLAGS.VIEW_CHANNEL]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes this channel.
|
* Deletes this channel.
|
||||||
* @param {string} [reason] Reason for deleting this channel
|
* @param {string} [reason] Reason for deleting this channel
|
||||||
|
|||||||
Reference in New Issue
Block a user